mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
27 lines
895 B
JavaScript
27 lines
895 B
JavaScript
define(['../internal/baseDifference', '../internal/baseFlatten', '../internal/isArrayLike', '../function/restParam'], function(baseDifference, baseFlatten, isArrayLike, restParam) {
|
|
|
|
/**
|
|
* Creates an array excluding all values of the provided arrays using
|
|
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {...Array} [values] The arrays of values to exclude.
|
|
* @returns {Array} Returns the new array of filtered values.
|
|
* @example
|
|
*
|
|
* _.difference([1, 2, 3], [4, 2]);
|
|
* // => [1, 3]
|
|
*/
|
|
var difference = restParam(function(array, values) {
|
|
return isArrayLike(array)
|
|
? baseDifference(array, baseFlatten(values, false, true))
|
|
: [];
|
|
});
|
|
|
|
return difference;
|
|
});
|