2016-07-24 09:52:04 -07:00
|
|
|
define(['./_baseDifference', './_baseRest', './isArrayLikeObject'], function(baseDifference, baseRest, isArrayLikeObject) {
|
2015-01-08 00:37:01 -08:00
|
|
|
|
|
|
|
|
/**
|
2016-02-07 23:04:40 -08:00
|
|
|
* Creates an array excluding all given values using
|
2016-08-07 21:21:03 -07:00
|
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
2015-12-16 17:50:05 -08:00
|
|
|
* for equality comparisons.
|
2015-01-08 00:37:01 -08:00
|
|
|
*
|
2016-07-24 09:52:04 -07:00
|
|
|
* **Note:** Unlike `_.pull`, this method returns a new array.
|
|
|
|
|
*
|
2015-01-08 00:37:01 -08:00
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
2016-03-26 00:00:01 -07:00
|
|
|
* @since 0.1.0
|
2015-01-08 00:37:01 -08:00
|
|
|
* @category Array
|
2016-05-07 11:49:46 -07:00
|
|
|
* @param {Array} array The array to inspect.
|
2015-01-08 00:37:01 -08:00
|
|
|
* @param {...*} [values] The values to exclude.
|
|
|
|
|
* @returns {Array} Returns the new array of filtered values.
|
2016-04-19 22:17:16 -07:00
|
|
|
* @see _.difference, _.xor
|
2015-01-08 00:37:01 -08:00
|
|
|
* @example
|
|
|
|
|
*
|
2016-05-21 00:48:34 -07:00
|
|
|
* _.without([2, 1, 2, 3], 1, 2);
|
2015-12-16 17:46:57 -08:00
|
|
|
* // => [3]
|
2015-01-08 00:37:01 -08:00
|
|
|
*/
|
2016-07-24 09:52:04 -07:00
|
|
|
var without = baseRest(function(array, values) {
|
2015-12-16 17:53:20 -08:00
|
|
|
return isArrayLikeObject(array)
|
2015-12-16 17:49:07 -08:00
|
|
|
? baseDifference(array, values)
|
|
|
|
|
: [];
|
|
|
|
|
});
|
2015-01-08 00:37:01 -08:00
|
|
|
|
|
|
|
|
return without;
|
|
|
|
|
});
|