mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Tweak _.intersection to still hit fast paths in engines.
Former-commit-id: e8cb944bd6223bb30d58da343c4b5a3f296a4956
This commit is contained in:
12
lodash.js
12
lodash.js
@@ -3993,20 +3993,22 @@
|
||||
seen = getArray();
|
||||
|
||||
while (++argsIndex < argsLength) {
|
||||
var value = argsIndex ? args[argsIndex] : seen;
|
||||
caches[argsIndex] = indexOf === basicIndexOf && (value && value.length) >= largeArraySize && createCache(value);
|
||||
var value = args[argsIndex];
|
||||
caches[argsIndex] = indexOf === basicIndexOf &&
|
||||
(value ? value.length : 0) >= largeArraySize &&
|
||||
createCache(argsIndex ? args[argsIndex] : seen);
|
||||
}
|
||||
outer:
|
||||
while (++index < length) {
|
||||
var cache = caches[0];
|
||||
value = array[index];
|
||||
|
||||
if ((cache ? cacheIndexOf : indexOf)(cache || seen, value) < 0) {
|
||||
if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
|
||||
argsIndex = argsLength;
|
||||
seen.push(value);
|
||||
(cache || seen).push(value);
|
||||
while (--argsIndex) {
|
||||
cache = caches[argsIndex];
|
||||
if ((cache ? cacheIndexOf : indexOf)(cache || args[argsIndex], value) < 0) {
|
||||
if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user