divvy
v0.0.6
Published
Divvies up an object's values into individual tuples
Downloads
3
Readme
Divvy
A tiny npm
package to split objects up conveniently.
Sometimes you want to take an object with keys, like this:
var object = {
countries: ['United States', 'Aruba', 'Russia', 'Japan'],
people: ['Chad', 'Joe', 'Ilyna', 'Sho']
};
...and split it up into separate 'items', if you will:
var citizens = divvy(object);
console.log(citizens); // Results in:
/*
[ { country: 'United States', person: 'Chad' },
{ country: 'Aruba', person: 'Joe' },
{ country: 'Russia', person: 'Ilyna' },
{ country: 'Japan', person: 'Sho' } ]
*/