Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
31 lines (29 sloc)
1.02 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import basePullAll from './.internal/basePullAll.js' | |
/** | |
* This method is like `pullAll` except that it accepts `iteratee` which is | |
* invoked for each element of `array` and `values` to generate the criterion | |
* by which they're compared. The iteratee is invoked with one argument: (value). | |
* | |
* **Note:** Unlike `differenceBy`, this method mutates `array`. | |
* | |
* @since 4.0.0 | |
* @category Array | |
* @param {Array} array The array to modify. | |
* @param {Array} values The values to remove. | |
* @param {Function} iteratee The iteratee invoked per element. | |
* @returns {Array} Returns `array`. | |
* @see pull, pullAll, pullAllWith, pullAt, remove, reject | |
* @example | |
* | |
* const array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }] | |
* | |
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x') | |
* console.log(array) | |
* // => [{ 'x': 2 }] | |
*/ | |
function pullAllBy(array, values, iteratee) { | |
return (array != null && array.length && values != null && values.length) | |
? basePullAll(array, values, iteratee) | |
: array | |
} | |
export default pullAllBy |