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
|
Line | |
---|
1 | import baseIteratee from './_baseIteratee.js';
|
---|
2 | import basePullAll from './_basePullAll.js';
|
---|
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 | export default pullAllBy;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.