mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Simplify createCache.
This commit is contained in:
@@ -1901,7 +1901,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) : undefined,
|
cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
|
||||||
valuesLength = values.length;
|
valuesLength = values.length;
|
||||||
|
|
||||||
if (cache) {
|
if (cache) {
|
||||||
@@ -2777,7 +2777,7 @@
|
|||||||
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() : undefined,
|
seen = isLarge ? createCache() : null,
|
||||||
result = [];
|
result = [];
|
||||||
|
|
||||||
if (seen) {
|
if (seen) {
|
||||||
@@ -3223,9 +3223,9 @@
|
|||||||
* @param {Array} [values] The values to cache.
|
* @param {Array} [values] The values to cache.
|
||||||
* @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
|
* @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
|
||||||
*/
|
*/
|
||||||
var createCache = !(nativeCreate && Set) ? constant(null) : function(values) {
|
function createCache(values) {
|
||||||
return new SetCache(values);
|
return (nativeCreate && Set) ? new SetCache(values) : null;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that produces compound words out of the words in a
|
* Creates a function that produces compound words out of the words in a
|
||||||
@@ -5114,7 +5114,7 @@
|
|||||||
|
|
||||||
while (othIndex--) {
|
while (othIndex--) {
|
||||||
var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
|
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],
|
var array = arrays[0],
|
||||||
index = -1,
|
index = -1,
|
||||||
|
|||||||
Reference in New Issue
Block a user