Skip to content

Returns an array with only the unique values from all given arrays using strict equality for comparisons.

License

Notifications You must be signed in to change notification settings

jonschlinkert/arr-diff

Repository files navigation

arr-diff NPM version Build Status

Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.

Why another array difference lib? I wanted the fastest, correct implementation I could find.

Install with npm

npm i arr-diff --save

Install with bower

bower install arr-diff --save

Usage

Return the difference between the first array and additional arrays.

  • a {Array}
  • b {Array}
  • returns: {Array}
var diff = require('{%= name %}');

var a = ['a', 'b', 'c', 'd'];
var b = ['b', 'c'];

console.log(diff(a, b))
//=> ['a', 'd']

Run tests

npm test

Author

Jon Schlinkert

Other javascript/node.js utils

Other projects that I maintain:

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license


This file was generated by verb on December 28, 2014.

About

Returns an array with only the unique values from all given arrays using strict equality for comparisons.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published