diff-arrays
Utility method for finding the difference between arrays, showing which array has which differences
Last updated 5 years ago by beeman .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install diff-arrays 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |