reduce-entries

Reduce array of objects into a single object


Keywords
reduce, entries, array
License
CC-BY-4.0
Install
npm install reduce-entries@0.0.1

Documentation

reduce-entries

CircleCI

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' }