mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
29 lines
742 B
JavaScript
29 lines
742 B
JavaScript
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 && array.length && values && values.length)
|
|
? basePullAll(array, values)
|
|
: array
|
|
}
|
|
|
|
export default pullAll
|