Skip to content

beeman/diff-arrays

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Compute the difference between input arrays and show which array has which differences

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.4%
  • Makefile 9.6%