Projekt

Obecné

Profil

Stáhnout (1.05 KB) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
var baseIteratee = require('./_baseIteratee'),
2
    basePullAll = require('./_basePullAll');
3
4
/**
5
 * This method is like `_.pullAll` except that it accepts `iteratee` which is
6
 * invoked for each element of `array` and `values` to generate the criterion
7
 * by which they're compared. The iteratee is invoked with one argument: (value).
8
 *
9
 * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
10
 *
11
 * @static
12
 * @memberOf _
13
 * @since 4.0.0
14
 * @category Array
15
 * @param {Array} array The array to modify.
16
 * @param {Array} values The values to remove.
17
 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
18
 * @returns {Array} Returns `array`.
19
 * @example
20
 *
21
 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
22
 *
23
 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
24
 * console.log(array);
25
 * // => [{ 'x': 2 }]
26
 */
27
function pullAllBy(array, values, iteratee) {
28
  return (array && array.length && values && values.length)
29
    ? basePullAll(array, values, baseIteratee(iteratee, 2))
30
    : array;
31
}
32
33
module.exports = pullAllBy;