Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-pivot

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-pivot

Pivot arrays of objects by key into a single object with a superset of keys containing arrays of each record's values.

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by700%
Maintainers
1
Weekly downloads
 
Created
Source

array-pivot

NPM

david-dm david-dm

Pivot arrays of objects by key into a single object with a superset of keys containing arrays of each record's values. Similar to a pivot table in a spreadsheet.

var pivot = require("array-pivot")

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

console.log(pivot(data))

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

API

pivot(data)

LICENSE

MIT

Keywords

FAQs

Package last updated on 05 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc