fdsfd
This commit is contained in:
parent
628618df89
commit
e031240dff
3749 changed files with 1120848 additions and 1 deletions
40
node_modules/lodash/differenceWith.js
generated
vendored
Normal file
40
node_modules/lodash/differenceWith.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
var baseDifference = require('./_baseDifference'),
|
||||
baseFlatten = require('./_baseFlatten'),
|
||||
baseRest = require('./_baseRest'),
|
||||
isArrayLikeObject = require('./isArrayLikeObject'),
|
||||
last = require('./last');
|
||||
|
||||
/**
|
||||
* This method is like `_.difference` except that it accepts `comparator`
|
||||
* which is invoked to compare elements of `array` to `values`. The order and
|
||||
* references of result values are determined by the first array. The comparator
|
||||
* is invoked with two arguments: (arrVal, othVal).
|
||||
*
|
||||
* **Note:** Unlike `_.pullAllWith`, this method returns a new array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {...Array} [values] The values to exclude.
|
||||
* @param {Function} [comparator] The comparator invoked per element.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @example
|
||||
*
|
||||
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
||||
*
|
||||
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
|
||||
* // => [{ 'x': 2, 'y': 1 }]
|
||||
*/
|
||||
var differenceWith = baseRest(function(array, values) {
|
||||
var comparator = last(values);
|
||||
if (isArrayLikeObject(comparator)) {
|
||||
comparator = undefined;
|
||||
}
|
||||
return isArrayLikeObject(array)
|
||||
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
|
||||
: [];
|
||||
});
|
||||
|
||||
module.exports = differenceWith;
|
Loading…
Add table
Add a link
Reference in a new issue