1 |
3a515b92
|
cagy
|
var baseDifference = require('./_baseDifference'),
|
2 |
|
|
baseRest = require('./_baseRest'),
|
3 |
|
|
isArrayLikeObject = require('./isArrayLikeObject');
|
4 |
|
|
|
5 |
|
|
/**
|
6 |
|
|
* Creates an array excluding all given values using
|
7 |
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
8 |
|
|
* for equality comparisons.
|
9 |
|
|
*
|
10 |
|
|
* **Note:** Unlike `_.pull`, this method returns a new array.
|
11 |
|
|
*
|
12 |
|
|
* @static
|
13 |
|
|
* @memberOf _
|
14 |
|
|
* @since 0.1.0
|
15 |
|
|
* @category Array
|
16 |
|
|
* @param {Array} array The array to inspect.
|
17 |
|
|
* @param {...*} [values] The values to exclude.
|
18 |
|
|
* @returns {Array} Returns the new array of filtered values.
|
19 |
|
|
* @see _.difference, _.xor
|
20 |
|
|
* @example
|
21 |
|
|
*
|
22 |
|
|
* _.without([2, 1, 2, 3], 1, 2);
|
23 |
|
|
* // => [3]
|
24 |
|
|
*/
|
25 |
|
|
var without = baseRest(function(array, values) {
|
26 |
|
|
return isArrayLikeObject(array)
|
27 |
|
|
? baseDifference(array, values)
|
28 |
|
|
: [];
|
29 |
|
|
});
|
30 |
|
|
|
31 |
|
|
module.exports = without;
|