1234567891011121314151617181920212223 |
- var unique = require('./unique');
- var filter = require('./filter');
- var some = require('./some');
- var contains = require('./contains');
- var slice = require('./slice');
- /**
- * Return a new Array with elements that aren't present in the other Arrays.
- */
- function difference(arr) {
- var arrs = slice(arguments, 1),
- result = filter(unique(arr), function(needle){
- return !some(arrs, function(haystack){
- return contains(haystack, needle);
- });
- });
- return result;
- }
- module.exports = difference;
|