array-xor
v0.1.1
Published
Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in all given arrays and not in their intersections).
Downloads
104
Maintainers
Readme
array-xor
Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in all given arrays and not in their intersections).
Install
Install with npm
$ npm i array-xor --save
Usage
var xor = require('array-xor');
// given the following arrays
var a = [1, 2, 3, 5, 9];
var b = [3, 4];
var c = [3, 5, 9, 4];
xor(a)
//=> [1, 2, 3, 5, 9]
xor(a, b)
//=> [1, 2, 5, 9, 4]
xor(a, c)
//=> [1, 2, 4]
xor(a, b, c)
//=> [1, 2, 3]
Related projects
- arr-diff: Returns an array with only the unique values from the first array, by excluding all… more | homepage
- array-intersection: Return an array with the unique values present in all given arrays using strict equality… more | homepage
- array-union: Create an array of unique values, in order, from the input arrays | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 26, 2015.