1.0.0 • Published 9 years ago

flatten-to-object v1.0.0

Weekly downloads
17
License
MIT
Repository
github
Last release
9 years ago

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