1 var arrayMap = require('./_arrayMap'),
2 baseAt = require('./_baseAt'),
3 basePullAt = require('./_basePullAt'),
4 compareAscending = require('./_compareAscending'),
5 flatRest = require('./_flatRest'),
6 isIndex = require('./_isIndex');
9 * Removes elements from `array` corresponding to `indexes` and returns an
10 * array of removed elements.
12 * **Note:** Unlike `_.at`, this method mutates `array`.
18 * @param {Array} array The array to modify.
19 * @param {...(number|number[])} [indexes] The indexes of elements to remove.
20 * @returns {Array} Returns the new array of removed elements.
23 * var array = ['a', 'b', 'c', 'd'];
24 * var pulled = _.pullAt(array, [1, 3]);
29 * console.log(pulled);
32 var pullAt = flatRest(function(array, indexes) {
33 var length = array == null ? 0 : array.length,
34 result = baseAt(array, indexes);
36 basePullAt(array, arrayMap(indexes, function(index) {
37 return isIndex(index, length) ? +index : index;
38 }).sort(compareAscending));
43 module.exports = pullAt;