b90d10dbcf95d88067bb5c00fe7cb116f2553f36
[yaffs-website] / node_modules / uncss / node_modules / lodash / pullAllBy.js
1 var baseIteratee = require('./internal/baseIteratee'),
2     basePullAllBy = require('./internal/basePullAllBy');
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 to generate the criterion
7  * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
8  *
9  * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
10  *
11  * @static
12  * @memberOf _
13  * @category Array
14  * @param {Array} array The array to modify.
15  * @param {Array} values The values to remove.
16  * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
17  * @returns {Array} Returns `array`.
18  * @example
19  *
20  * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
21  *
22  * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
23  * console.log(array);
24  * // => [{ 'x': 2 }]
25  */
26 function pullAllBy(array, values, iteratee) {
27   return (array && array.length && values && values.length)
28     ? basePullAllBy(array, values, baseIteratee(iteratee))
29     : array;
30 }
31
32 module.exports = pullAllBy;