arrayofobjectsintersection

1.0.5 • Public • Published

arrayofobjectsintersection

Can use this package to find out the common objects in between the n number of arrays and on the basis of n number of keys

Install

npm install --save arrayofobjectsintersection

Usage

const testModule = require('arrayofobjectsintersection');

let firstArray = [ { "id":"test", "displayName" : "Test" } { "id":"demo", "displayName" : "Demo" } ]; let secondArray = [ { "id" : "test", "displayName" : "Test" } ]; let thirdArray = [ { "id" : "test", "displayName" : "Test" }, { "id" : "user", "displayName" : "User" } ] testModule.findCommonObjectsOfArrays(["id"], firstArray, secondArray, thirdArray);

//result will be [ { "key" : "test", "displayName" : "Test" } ]

When we compare all the objects in each and every array on the basis key id that is mentioned in the first parameter of findIntersectionOfArray, test id is common in all the arrays. So the result will have this object.

You can pass any number of keys in the first parameter in array format. Also you can any number of arrays from second parameter onwards

Package Sidebar

Install

npm i arrayofobjectsintersection

Weekly Downloads

0

Version

1.0.5

License

ISC

Unpacked Size

3.02 kB

Total Files

3

Last publish

Collaborators

  • pradeepaanumalla