@newdash/newdash
Version:
javascript/typescript utility library
36 lines (35 loc) • 1.09 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.pullAll = void 0;
const basePullAll_1 = __importDefault(require("./.internal/basePullAll"));
/**
* This method is like `pull` except that it accepts an array of values to remove.
*
* **Note:** Unlike `difference`, this method mutates `array`.
*
* @since 5.11.0
* @category Array
* @param array The array to modify.
* @param values The values to remove.
* @returns Returns `array`.
* @see [[pull]], [[pullAllBy]], [[pullAllWith]], [[pullAt]], [[remove]], [[reject]]
* @example
*
* ```js
* 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)
? (0, basePullAll_1.default)(array, values)
: array;
}
exports.pullAll = pullAll;
exports.default = pullAll;