Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | var baseDifference = require('./_baseDifference'),
|
---|
2 | baseFlatten = require('./_baseFlatten'),
|
---|
3 | baseRest = require('./_baseRest'),
|
---|
4 | isArrayLikeObject = require('./isArrayLikeObject');
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * Creates an array of `array` values not included in the other given arrays
|
---|
8 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
---|
9 | * for equality comparisons. The order and references of result values are
|
---|
10 | * determined by the first array.
|
---|
11 | *
|
---|
12 | * **Note:** Unlike `_.pullAll`, this method returns a new array.
|
---|
13 | *
|
---|
14 | * @static
|
---|
15 | * @memberOf _
|
---|
16 | * @since 0.1.0
|
---|
17 | * @category Array
|
---|
18 | * @param {Array} array The array to inspect.
|
---|
19 | * @param {...Array} [values] The values to exclude.
|
---|
20 | * @returns {Array} Returns the new array of filtered values.
|
---|
21 | * @see _.without, _.xor
|
---|
22 | * @example
|
---|
23 | *
|
---|
24 | * _.difference([2, 1], [2, 3]);
|
---|
25 | * // => [1]
|
---|
26 | */
|
---|
27 | var difference = baseRest(function(array, values) {
|
---|
28 | return isArrayLikeObject(array)
|
---|
29 | ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
|
---|
30 | : [];
|
---|
31 | });
|
---|
32 |
|
---|
33 | module.exports = difference;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.