diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 439e7919f..adab74baa 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -179,17 +179,17 @@ cache = cache.cache; if (type == 'boolean' || value == null) { - return cache[value]; + return cache[value] ? 0 : -1; } if (type != 'number' && type != 'string') { type = 'object'; } var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); + cache = (cache = cache[type]) && cache[key]; return type == 'object' - ? (cache[key] && baseIndexOf(cache[key], value) > -1 ? 0 : -1) - : (cache[key] ? 0 : -1); + ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) + : (cache ? 0 : -1); } /** diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 64b0692de..4397fa895 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,8 +3,8 @@ * Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;!function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(er||typeof e=="undefined")return 1;if(ee?0:e);++r -1 ? 0 : -1) - : (cache[key] ? 0 : -1); + ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) + : (cache ? 0 : -1); } /** diff --git a/dist/lodash.min.js b/dist/lodash.min.js index fffc2f8c1..1ecada6ed 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,8 +3,8 @@ * Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;!function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(er||typeof e=="undefined")return 1;if(ee?0:e);++r -1 ? 0 : -1) - : (cache[key] ? 0 : -1); + ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) + : (cache ? 0 : -1); } /** diff --git a/test/test.js b/test/test.js index 7512fe700..3ca8f0436 100644 --- a/test/test.js +++ b/test/test.js @@ -4004,6 +4004,17 @@ deepEqual(actual, [[2, 1], [1, 2]]); }); + test('should work with large arrays of boolean, `null`, and `undefined` values', function() { + var array = [], + expected = [true, false, null, undefined], + count = Math.ceil(largeArraySize / expected.length); + + _.times(count, function() { + push.apply(array, expected); + }); + deepEqual(_.uniq(array), expected); + }); + test('should distinguish between numbers and numeric strings', function() { var array = [], expected = ['2', 2, Object('2'), Object(2)],