array-unpivot

1.0.18 • Public • Published

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.

Package Sidebar

Install

npm i array-unpivot

Weekly Downloads

5

Version

1.0.18

License

Apache-2.0

Unpacked Size

15.3 kB

Total Files

7

Last publish

Collaborators

  • hanjukim