mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Move parseFloat into isIndex. [closes #1209]
This commit is contained in:
@@ -2669,7 +2669,7 @@
|
|||||||
function basePullAt(array, indexes) {
|
function basePullAt(array, indexes) {
|
||||||
var length = array ? indexes.length : 0;
|
var length = array ? indexes.length : 0;
|
||||||
while (length--) {
|
while (length--) {
|
||||||
var index = parseFloat(indexes[length]);
|
var index = indexes[length];
|
||||||
if (index != previous && isIndex(index)) {
|
if (index != previous && isIndex(index)) {
|
||||||
var previous = index;
|
var previous = index;
|
||||||
splice.call(array, index, 1);
|
splice.call(array, index, 1);
|
||||||
@@ -4268,7 +4268,7 @@
|
|||||||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
||||||
*/
|
*/
|
||||||
function isIndex(value, length) {
|
function isIndex(value, length) {
|
||||||
value = +value;
|
value = typeof value == 'number' ? value : parseFloat(value);
|
||||||
length = length == null ? MAX_SAFE_INTEGER : length;
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
||||||
return value > -1 && value % 1 == 0 && value < length;
|
return value > -1 && value % 1 == 0 && value < length;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user