mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Simplify createCache.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user