Socket
Socket
Sign inDemoInstall

diff-array-objs

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    diff-array-objs

Diff two arrays of objects based on a specific property.


Version published
Weekly downloads
24
decreased by-7.69%
Maintainers
1
Install size
6.44 kB
Created
Weekly downloads
 

Readme

Source

diff-array-objs

Diff two arrays of objects based on a specific property.

Build Status

usage

diffArrayObjs(firstArray, secondArray, property, shouldReturnCommon)

example

var diffArrayObjsByProp = require('./');

var a = [{
  a: 1, b: 2, c: 3, id: 0
}, {
  a: 1, b: 3, c: 3, id: 1
}, {
  a: 1, b: 3, c: 9, id: 2
}];

var b = [{
  a: 1, b: 2, c: 3, id: 0
}, {
  a: 1, b: 3, c: 3, id: 1
}, {
  a: 1, b: 3, c: 9, id: 3
}];

console.log(diffArrayObjsByProp(a, b, 'id'));
//
// Sample output:
//
// { added: [ { a: 1, b: 3, c: 9, id: 3 } ],
//   removed: [ { a: 1, b: 3, c: 9, id: 2 } ] }

tests

npm test

license

MIT

FAQs

Last updated on 17 Dec 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc