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.
28 lines (26 sloc)
758 Bytes
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 `pull` except that it accepts an array of values to remove. | |
* | |
* **Note:** Unlike `difference`, this method mutates `array`. | |
* | |
* @since 4.0.0 | |
* @category Array | |
* @param {Array} array The array to modify. | |
* @param {Array} values The values to remove. | |
* @returns {Array} Returns `array`. | |
* @see pull, pullAllBy, pullAllWith, pullAt, remove, reject | |
* @example | |
* | |
* const array = ['a', 'b', 'c', 'a', 'b', 'c'] | |
* | |
* pullAll(array, ['a', 'c']) | |
* console.log(array) | |
* // => ['b', 'b'] | |
*/ | |
function pullAll(array, values) { | |
return (array != null && array.length && values != null && values.length) | |
? basePullAll(array, values) | |
: array | |
} | |
export default pullAll |