Sha256: bba30e5ff749bb138fb61863f96df81b4f086fa982e49ff30d395568d7a0c409

Contents?: true

Size: 1.42 KB

Versions: 279

Compression:

Stored size: 1.42 KB

Contents

var arrayMap = require('./_arrayMap'),
    baseIndexOf = require('./_baseIndexOf'),
    baseIndexOfWith = require('./_baseIndexOfWith'),
    baseUnary = require('./_baseUnary'),
    copyArray = require('./_copyArray');

/** Used for built-in method references. */
var arrayProto = Array.prototype;

/** Built-in value references. */
var splice = arrayProto.splice;

/**
 * The base implementation of `_.pullAllBy` without support for iteratee
 * shorthands.
 *
 * @private
 * @param {Array} array The array to modify.
 * @param {Array} values The values to remove.
 * @param {Function} [iteratee] The iteratee invoked per element.
 * @param {Function} [comparator] The comparator invoked per element.
 * @returns {Array} Returns `array`.
 */
function basePullAll(array, values, iteratee, comparator) {
  var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
      index = -1,
      length = values.length,
      seen = array;

  if (array === values) {
    values = copyArray(values);
  }
  if (iteratee) {
    seen = arrayMap(array, baseUnary(iteratee));
  }
  while (++index < length) {
    var fromIndex = 0,
        value = values[index],
        computed = iteratee ? iteratee(value) : value;

    while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
      if (seen !== array) {
        splice.call(seen, fromIndex, 1);
      }
      splice.call(array, fromIndex, 1);
    }
  }
  return array;
}

module.exports = basePullAll;

Version data entries

279 entries across 275 versions & 31 rubygems

Version Path
immosquare-cleaner-0.1.27 node_modules/lodash/_basePullAll.js
immosquare-cleaner-0.1.26 node_modules/lodash/_basePullAll.js
immosquare-cleaner-0.1.25 node_modules/lodash/_basePullAll.js
immosquare-cleaner-0.1.24 node_modules/lodash/_basePullAll.js
immosquare-cleaner-0.1.23 node_modules/lodash/_basePullAll.js
sumomo-0.10.4 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.10.3 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.10.2 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.10.1 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.10.0 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
reed_sdk-1.0.1 node_modules/lodash/_basePullAll.js
reed_sdk-1.0.0 node_modules/lodash/_basePullAll.js
boring_generators-0.12.0 tmp/templates/app_template/node_modules/lodash/_basePullAll.js
sumomo-0.9.0 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.8.22 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.8.21 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.8.20 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.8.17 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
sumomo-0.8.16 data/sumomo/api_modules/node_modules/lodash/_basePullAll.js
disco_app-0.18.0 test/dummy/node_modules/lodash/_basePullAll.js