Sha256: 986952ae131d654fde22c45863ee62f8bf0b06504bcd20e3bceee4435954c9e0

Contents?: true

Size: 1.2 KB

Versions: 153

Compression:

Stored size: 1.2 KB

Contents

var baseAt = require('../internal/baseAt'),
    baseCompareAscending = require('../internal/baseCompareAscending'),
    baseFlatten = require('../internal/baseFlatten'),
    basePullAt = require('../internal/basePullAt'),
    restParam = require('../function/restParam');

/**
 * Removes elements from `array` corresponding to the given indexes and returns
 * an array of the removed elements. Indexes may be specified as an array of
 * indexes or as individual arguments.
 *
 * **Note:** Unlike `_.at`, this method mutates `array`.
 *
 * @static
 * @memberOf _
 * @category Array
 * @param {Array} array The array to modify.
 * @param {...(number|number[])} [indexes] The indexes of elements to remove,
 *  specified as individual indexes or arrays of indexes.
 * @returns {Array} Returns the new array of removed elements.
 * @example
 *
 * var array = [5, 10, 15, 20];
 * var evens = _.pullAt(array, 1, 3);
 *
 * console.log(array);
 * // => [5, 15]
 *
 * console.log(evens);
 * // => [10, 20]
 */
var pullAt = restParam(function(array, indexes) {
  indexes = baseFlatten(indexes);

  var result = baseAt(array, indexes);
  basePullAt(array, indexes.sort(baseCompareAscending));
  return result;
});

module.exports = pullAt;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/array/pullAt.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/pullAt.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/array/pullAt.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/array/pullAt.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/array/pullAt.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/pullAt.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/array/pullAt.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/array/pullAt.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/pullAt.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/pullAt.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/pullAt.js