8 lines
234 B
JavaScript
8 lines
234 B
JavaScript
/*! fromentries. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
module.exports = function fromEntries (iterable) {
|
|
return [...iterable].reduce((obj, [key, val]) => {
|
|
obj[key] = val
|
|
return obj
|
|
}, {})
|
|
}
|