main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[d565449] | 1 | import baseDifference from './_baseDifference.js';
|
---|
| 2 | import baseFlatten from './_baseFlatten.js';
|
---|
| 3 | import baseRest from './_baseRest.js';
|
---|
| 4 | import isArrayLikeObject from './isArrayLikeObject.js';
|
---|
| 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 | export default difference;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.