diff options
Diffstat (limited to 'tools/eslint/node_modules/lodash/differenceWith.js')
-rw-r--r-- | tools/eslint/node_modules/lodash/differenceWith.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/lodash/differenceWith.js b/tools/eslint/node_modules/lodash/differenceWith.js new file mode 100644 index 0000000000..b60f3a0681 --- /dev/null +++ b/tools/eslint/node_modules/lodash/differenceWith.js @@ -0,0 +1,36 @@ +var baseDifference = require('./_baseDifference'), + baseFlatten = require('./_baseFlatten'), + isArrayLikeObject = require('./isArrayLikeObject'), + last = require('./last'), + rest = require('./rest'); + +/** + * This method is like `_.difference` except that it accepts `comparator` + * which is invoked to compare elements of `array` to `values`. The comparator + * is invoked with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @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 = rest(function(array, values) { + var comparator = last(values); + if (isArrayLikeObject(comparator)) { + comparator = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, false, true), undefined, comparator) + : []; +}); + +module.exports = differenceWith; |