Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

object-transpose

2.0.1 • Public • Published

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

Install

npm i object-transpose

DownloadsWeekly Downloads

29

Version

2.0.1

License

ISC

Last publish

Collaborators

  • avatar
  • avatar