mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
fix _.removeAt with repeated indexes
This commit is contained in:
committed by
John-David Dalton
parent
95bd2dde19
commit
ff26080c5c
12
lodash.js
12
lodash.js
@@ -2927,9 +2927,17 @@
|
||||
} else {
|
||||
removals.sort(baseCompareAscending);
|
||||
}
|
||||
var result = Array(length);
|
||||
var result = Array(length),
|
||||
adjust = -1,
|
||||
removal, prev;
|
||||
while(++index < length) {
|
||||
result[index] = splice.call(array, removals[index] - index, 1)[0];
|
||||
removal = removals[index];
|
||||
if (removal === prev) {
|
||||
result[index] = result[index - 1];
|
||||
continue;
|
||||
}
|
||||
prev = removal;
|
||||
result[index] = splice.call(array, removal - ++adjust, 1)[0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user