reduce-entries
Basically, the opposite of d3's .entries()
, takes an array of objects with key
and value
keys and reduces it into a single object.
import reduceEntries from 'reduce-entries'
const entries = [
{ key: 'foo', value: 'bar' },
{ key: 'dude', value: 'yo' }
]
const single = entries.reduce(reduceEntries())
console.log(single) // { foo: 'bar', dude: 'yo' }