js-fns
Version:
Modern JavaScript utility library focused on the build size
36 lines (31 loc) • 671 B
JavaScript
exports.default = fromEntries
/**
* Returns an object composed from entries, an array of [key, value].
*
* @param array - The entries, an array of [key, value]
* @returns an object composed from the entries
*
* @category Array
* @public
*/
/**
* Returns an object composed from entries, an array of [key, value].
*
* @param array - The entries, an array of [key, value]
* @returns an object composed from the entries
*
* @category Array
* @public
*/
/**
* @internal
*/
function fromEntries(array) {
return array.reduce(function (acc, _ref) {
var key = _ref[0],
value = _ref[1]
acc[key] = value
return acc
}, {})
}