array-to-object
v1.1.0
Published
Transform two arrays into an object
Downloads
104
Readme
array-to-object
Converts arrays into objects. Pass an array of keys and values. If duplicate keys exist, the last value wins.
####API
var arrToObj = require('array-to-object');
var keys = ['moe', 'larry', 'curly', 2014];
var values = [30, 40, 50, {month: 'May', day: 17}];
var object = arrToObj(keys, values);
// output:
{ '2014': { month: 'May', day: 17 }, moe: 30, larry: 40, curly: 50 }