1 | var baseUnset = require('./_baseUnset'),
|
2 | isIndex = require('./_isIndex');
|
3 |
|
4 |
|
5 | var arrayProto = Array.prototype;
|
6 |
|
7 |
|
8 | var splice = arrayProto.splice;
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | function basePullAt(array, indexes) {
|
20 | var length = array ? indexes.length : 0,
|
21 | lastIndex = length - 1;
|
22 |
|
23 | while (length--) {
|
24 | var index = indexes[length];
|
25 | if (length == lastIndex || index !== previous) {
|
26 | var previous = index;
|
27 | if (isIndex(index)) {
|
28 | splice.call(array, index, 1);
|
29 | } else {
|
30 | baseUnset(array, index);
|
31 | }
|
32 | }
|
33 | }
|
34 | return array;
|
35 | }
|
36 |
|
37 | module.exports = basePullAt;
|