Skip to content

Transpose between object of arrays and array of objects

Notifications You must be signed in to change notification settings

sphinxrave/object-transpose

This branch is up to date with emilbayes/object-transpose:master.

Repository files navigation

Object Transpose

build status NPM version

Transpose between array of objects and object of arrays. Supports objects of sparse arrays and arrays of irregular objects.

See test.js for examples.

Installation

npm install --save object-transpose

Example

var assert = require('assert');
var T = require('object-transpose');

var collection = [
   { a: 1, b: 10 },
   { a: 2, b: 20}
];

assert.deepEqual(T(collection), { a: [1, 2], b: [10, 20] });
assert.deepEqual(T(T(collection)), collection);

License

ISC

About

Transpose between object of arrays and array of objects

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%