diff-arrays

1.0.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i diff-arrays

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • beeman