🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

diff-arrays

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diff-arrays

Utility method for finding the difference between arrays, showing which array has which differences

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Diff Arrays

browser support

Utility method to compute the difference between two arrays. AMD and CommonJS compatible; works in Node.js and the browser.

It's fork of array-difference that shows in the output if the difference is on the left-hand side (lhs) or right-hand side (rhs).

Thanks Mike Pennisi for the original.

Installation

$ npm install diff-arrays

Example

var da = require('diff-arrays');

var left = [
  'anyone@example.com',
  'anytwo@example.com',
  'anythre@example.com',
  'anyfour@example.com'
];

var right = [
  'anyfour@example.com',
  'anyfive@example.com',
  'anysix@example.com',
  'anyseven@example.com'
];

var diff = da(left, right);

console.log(diff);

Outputs

{ lhs:
  [ 'anyone@example.com',
    'anytwo@example.com',
    'anythre@example.com' ],
    rhs:
  [ 'anyfive@example.com',
    'anysix@example.com',
    'anyseven@example.com' ] }

License

Copyright (c) 2015 Bram Borggreve
Licensed under the MIT license.

Copyright (c) 2013 Mike Pennisi
Licensed under the MIT Expat license.

Keywords

utility

FAQs

Package last updated on 17 Sep 2015

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