mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Conditionally define createCache base on feature inference.
This commit is contained in:
10
dist/lodash.compat.js
vendored
10
dist/lodash.compat.js
vendored
@@ -1319,7 +1319,7 @@
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
|
||||
if (Set && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf) {
|
||||
if (createCache && indexOf === baseIndexOf && length >= LARGE_ARRAY_SIZE) {
|
||||
indexOf = cacheIndexOf;
|
||||
values = createCache(values);
|
||||
}
|
||||
@@ -1692,7 +1692,7 @@
|
||||
var index = -1,
|
||||
indexOf = getIndexOf(),
|
||||
length = array ? array.length : 0,
|
||||
isLarge = Set && !isSorted && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf,
|
||||
isLarge = createCache && !isSorted && indexOf === baseIndexOf && length >= LARGE_ARRAY_SIZE,
|
||||
result = [];
|
||||
|
||||
if (isLarge) {
|
||||
@@ -1760,7 +1760,7 @@
|
||||
* @param {Array} [array=[]] The array to search.
|
||||
* @returns {Object} Returns the cache object.
|
||||
*/
|
||||
function createCache(array) {
|
||||
var createCache = Set && function(array) {
|
||||
var cache = new Set,
|
||||
length = array ? array.length : 0;
|
||||
|
||||
@@ -1769,7 +1769,7 @@
|
||||
cache.push(array[length]);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a function that, when called, either curries or invokes `func`
|
||||
@@ -2435,7 +2435,7 @@
|
||||
argsLength = arguments.length,
|
||||
caches = getArray(),
|
||||
indexOf = getIndexOf(),
|
||||
largePrereq = Set && indexOf === baseIndexOf,
|
||||
largePrereq = createCache && indexOf === baseIndexOf,
|
||||
seen = getArray();
|
||||
|
||||
while (++argsIndex < argsLength) {
|
||||
|
||||
Reference in New Issue
Block a user