1 var arrayMap = require('./_arrayMap'),
2 baseIndexOf = require('./_baseIndexOf'),
3 baseIndexOfWith = require('./_baseIndexOfWith'),
4 baseUnary = require('./_baseUnary'),
5 copyArray = require('./_copyArray');
7 /** Used for built-in method references. */
8 var arrayProto = Array.prototype;
10 /** Built-in value references. */
11 var splice = arrayProto.splice;
14 * The base implementation of `_.pullAllBy` without support for iteratee
18 * @param {Array} array The array to modify.
19 * @param {Array} values The values to remove.
20 * @param {Function} [iteratee] The iteratee invoked per element.
21 * @param {Function} [comparator] The comparator invoked per element.
22 * @returns {Array} Returns `array`.
24 function basePullAll(array, values, iteratee, comparator) {
25 var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
27 length = values.length,
30 if (array === values) {
31 values = copyArray(values);
34 seen = arrayMap(array, baseUnary(iteratee));
36 while (++index < length) {
38 value = values[index],
39 computed = iteratee ? iteratee(value) : value;
41 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
43 splice.call(seen, fromIndex, 1);
45 splice.call(array, fromIndex, 1);
51 module.exports = basePullAll;