You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
858 B

var baseDifference = require('./_baseDifference'),
baseFlatten = require('./_baseFlatten'),
isArrayLikeObject = require('./isArrayLikeObject'),
rest = require('./rest');
/**
* Creates an array of unique `array` values not included in the other
* given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.difference([3, 2, 1], [4, 2]);
* // => [3, 1]
*/
var difference = rest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, false, true))
: [];
});
module.exports = difference;