Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var baseDifference = require('../internal/baseDifference'),
2
isArrayLike = require('../internal/isArrayLike'),
3
restParam = require('../function/restParam');
4
5
/**
6
* Creates an array excluding all provided values using
7
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
8
* for equality comparisons.
9
*
10
* @static
11
* @memberOf _
12
* @category Array
13
* @param {Array} array The array to filter.
14
* @param {...*} [values] The values to exclude.
15
* @returns {Array} Returns the new array of filtered values.
16
* @example
17
*
18
* _.without([1, 2, 1, 3], 1, 2);
19
* // => [3]
20
*/
21
var without = restParam(function(array, values) {
22
return isArrayLike(array)
23
? baseDifference(array, values)
24
: [];
25
});
26
27
module.exports = without;
28
29