Use strict equality checks for baseIndexOf comparisons.

This commit is contained in:
John-David Dalton
2015-07-08 10:42:44 -07:00
parent fbc7c28188
commit 230f90173c

View File

@@ -620,7 +620,7 @@
* @private * @private
* @param {Array} array The array to inspect. * @param {Array} array The array to inspect.
* @param {Function} [iteratee] The function invoked per iteration. * @param {Function} [iteratee] The function invoked per iteration.
* @returns {Array} Returns the new duplicate-value-free array. * @returns {Array} Returns the new duplicate free array.
*/ */
function sortedUniq(array, iteratee) { function sortedUniq(array, iteratee) {
var seen, var seen,
@@ -1925,7 +1925,7 @@
} }
var index = -1, var index = -1,
indexOf = getIndexOf(), indexOf = getIndexOf(),
isCommon = indexOf == baseIndexOf, isCommon = indexOf === baseIndexOf,
cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null, cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
valuesLength = values.length; valuesLength = values.length;
@@ -2794,13 +2794,13 @@
* @private * @private
* @param {Array} array The array to inspect. * @param {Array} array The array to inspect.
* @param {Function} [iteratee] The function invoked per iteration. * @param {Function} [iteratee] The function invoked per iteration.
* @returns {Array} Returns the new duplicate-value-free array. * @returns {Array} Returns the new duplicate free array.
*/ */
function baseUniq(array, iteratee) { function baseUniq(array, iteratee) {
var index = -1, var index = -1,
indexOf = getIndexOf(), indexOf = getIndexOf(),
length = array.length, length = array.length,
isCommon = indexOf == baseIndexOf, isCommon = indexOf === baseIndexOf,
isLarge = isCommon && length >= LARGE_ARRAY_SIZE, isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
seen = isLarge ? createCache() : null, seen = isLarge ? createCache() : null,
result = []; result = [];
@@ -5159,7 +5159,7 @@
othIndex = othLength, othIndex = othLength,
caches = Array(length), caches = Array(length),
indexOf = getIndexOf(), indexOf = getIndexOf(),
isCommon = indexOf == baseIndexOf, isCommon = indexOf === baseIndexOf,
result = []; result = [];
while (othIndex--) { while (othIndex--) {
@@ -5776,7 +5776,7 @@
if (!(iteratee == null && callback === baseCallback)) { if (!(iteratee == null && callback === baseCallback)) {
iteratee = callback(iteratee, thisArg, 3); iteratee = callback(iteratee, thisArg, 3);
} }
return (isSorted && getIndexOf() == baseIndexOf) return (isSorted && getIndexOf() === baseIndexOf)
? sortedUniq(array, iteratee) ? sortedUniq(array, iteratee)
: baseUniq(array, iteratee); : baseUniq(array, iteratee);
} }