diff --git a/lodash.src.js b/lodash.src.js index 0cd26add2..aee248326 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -314,14 +314,14 @@ * @private * @param {Array} array The array to search. * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. + * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { if (value !== value) { return indexOfNaN(array, fromIndex); } - var index = fromIndex == null ? -1 : (fromIndex - 1), + var index = fromIndex - 1, length = array.length; while (++index < length) { @@ -509,13 +509,13 @@ * * @private * @param {Array} array The array to search. - * @param {number} [fromIndex] The index to search from. + * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched `NaN`, else `-1`. */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, - index = fromIndex == null ? (fromRight ? length : -1) : (fromIndex + (fromRight ? 0 : -1)); + index = fromIndex + (fromRight ? 0 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; @@ -1991,7 +1991,7 @@ } result.push(value); } - else if (indexOf(values, value) < 0) { + else if (indexOf(values, value, 0) < 0) { result.push(value); } } @@ -2817,7 +2817,7 @@ } result.push(value); } - else if (indexOf(seen, computed) < 0) { + else if (indexOf(seen, computed, 0) < 0) { if (iteratee || isLarge) { seen.push(computed); } @@ -4725,14 +4725,14 @@ return -1; } if (typeof fromIndex == 'number') { - fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; } else if (fromIndex) { var index = binaryIndex(array, value), other = array[index]; return (value === value ? value === other : other !== other) ? index : -1; } - return baseIndexOf(array, value, fromIndex); + return baseIndexOf(array, value, fromIndex || 0); } /** @@ -4795,11 +4795,11 @@ outer: while (++index < length) { value = array[index]; - if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value)) < 0) { + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { argsIndex = argsLength; while (--argsIndex) { var cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { continue outer; } }