Projekt

Obecné

Profil

Stáhnout (1 KB) Statistiky
| Větev: | Revize:
1
var basePullAll = require('./_basePullAll');
2

    
3
/**
4
 * This method is like `_.pullAll` except that it accepts `comparator` which
5
 * is invoked to compare elements of `array` to `values`. The comparator is
6
 * invoked with two arguments: (arrVal, othVal).
7
 *
8
 * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
9
 *
10
 * @static
11
 * @memberOf _
12
 * @since 4.6.0
13
 * @category Array
14
 * @param {Array} array The array to modify.
15
 * @param {Array} values The values to remove.
16
 * @param {Function} [comparator] The comparator invoked per element.
17
 * @returns {Array} Returns `array`.
18
 * @example
19
 *
20
 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
21
 *
22
 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
23
 * console.log(array);
24
 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
25
 */
26
function pullAllWith(array, values, comparator) {
27
  return (array && array.length && values && values.length)
28
    ? basePullAll(array, values, undefined, comparator)
29
    : array;
30
}
31

    
32
module.exports = pullAllWith;
(520-520/634)