1 var baseAt = require('../internal/baseAt'),
2 baseCompareAscending = require('../internal/baseCompareAscending'),
3 baseFlatten = require('../internal/baseFlatten'),
4 basePullAt = require('../internal/basePullAt'),
5 restParam = require('../function/restParam');
8 * Removes elements from `array` corresponding to the given indexes and returns
9 * an array of the removed elements. Indexes may be specified as an array of
10 * indexes or as individual arguments.
12 * **Note:** Unlike `_.at`, this method mutates `array`.
17 * @param {Array} array The array to modify.
18 * @param {...(number|number[])} [indexes] The indexes of elements to remove,
19 * specified as individual indexes or arrays of indexes.
20 * @returns {Array} Returns the new array of removed elements.
23 * var array = [5, 10, 15, 20];
24 * var evens = _.pullAt(array, 1, 3);
32 var pullAt = restParam(function(array, indexes) {
33 indexes = baseFlatten(indexes);
35 var result = baseAt(array, indexes);
36 basePullAt(array, indexes.sort(baseCompareAscending));
40 module.exports = pullAt;