From 419fb082669e6bfde90c81177ecc29c55e7e4231 Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 11 Jun 2015 07:31:36 -0700 Subject: [PATCH] Simplify `createCache`. --- lodash.src.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 1167f0748..2011db9da 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -1901,7 +1901,7 @@ var index = -1, indexOf = getIndexOf(), isCommon = indexOf == baseIndexOf, - cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : undefined, + cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null, valuesLength = values.length; if (cache) { @@ -2777,7 +2777,7 @@ length = array.length, isCommon = indexOf == baseIndexOf, isLarge = isCommon && length >= LARGE_ARRAY_SIZE, - seen = isLarge ? createCache() : undefined, + seen = isLarge ? createCache() : null, result = []; if (seen) { @@ -3223,9 +3223,9 @@ * @param {Array} [values] The values to cache. * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. */ - var createCache = !(nativeCreate && Set) ? constant(null) : function(values) { - return new SetCache(values); - }; + function createCache(values) { + return (nativeCreate && Set) ? new SetCache(values) : null; + } /** * Creates a function that produces compound words out of the words in a @@ -5114,7 +5114,7 @@ while (othIndex--) { var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : []; - caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : undefined; + caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null; } var array = arrays[0], index = -1,