Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
858 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.