Skip to content

Pivot object of arrays into arrays of object

License

Notifications You must be signed in to change notification settings

hanjukim/array-unpivot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

array-unpivot

NPM

Pivot object of arrays into arrays of object. Inverse function for array-pivot

Install

$ npm install array-unpivot

Usage

var unpivot = require('array-unpivot')

var data = {
  foo: [1311, 41, 159],
  bar: ['cat', 11, 41],
  zzz: [124.31, 55],
  aaa: [12]
};

console.log(unpivot(data))

/*
[ { foo: 1311, bar: 'cat', zzz: 124.31, aaa: 12 },
  { foo: 41, bar: 11, zzz: 55 },
  { foo: 159, bar: 41 } ]
*/

API

unpivot(data)

data

Type: Object

Object of arrays

License

Source files are distributed under the Apache Version 2.0 license found in the LICENSE file.

About

Pivot object of arrays into arrays of object

Resources

License

Stars

Watchers

Forks

Packages

No packages published