Move parseFloat into isIndex. [closes #1209]

This commit is contained in:
jdalton
2015-05-15 08:55:47 -07:00
parent b25cd39953
commit 698956e130

View File

@@ -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;
} }