to-object-reducer
Simple JavaScript/Node.js module which exports a toObject
reducer that can be used with arr.reduce(toObject)
to convert an array
[[key,value],...]
to an object { key: value, ... }
.
Example:
'username' 'olalonde' 'id'1337// => { username: 'olalonde', id: 1337 }
Install
npm install --save to-object-reducer
Usage
It is meant to facilitate the pattern of converting an object to an
array of [key,val]
for easier manipulation with Array methods and back
to an object, e.g.:
const toObject = // Lower case object keysconst lowerCaseHeaders = Object // Or with ES2017 Object.entriesconst lowerCaseHeaders = Object
License
MIT