flatten-to-object

1.0.0 • Public • Published

flatten-to-object

Flatten an array of objects to a single object

Install

npm install flatten-to-object --save

Usage

var flattenToObject = require('flatten-to-object');

var arr = [
  {
    key1: 'value1',
    key2: 'value2'
  },
  {
    key3: 'value3'
  }
];

console.log(flattenToObject(arr));

// OUTPUTS:
// {
//   key1: 'value1',
//   key2: 'value2',
//   key3: ''
// }

Run Tests

npm install
npm test

Readme

Keywords

Package Sidebar

Install

npm i flatten-to-object

Weekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • scottcorgan