mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11: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();
|
seen = getArray();
|
||||||
|
|
||||||
while (++argsIndex < argsLength) {
|
while (++argsIndex < argsLength) {
|
||||||
var value = argsIndex ? args[argsIndex] : seen;
|
var value = args[argsIndex];
|
||||||
caches[argsIndex] = indexOf === basicIndexOf && (value && value.length) >= largeArraySize && createCache(value);
|
caches[argsIndex] = indexOf === basicIndexOf &&
|
||||||
|
(value ? value.length : 0) >= largeArraySize &&
|
||||||
|
createCache(argsIndex ? args[argsIndex] : seen);
|
||||||
}
|
}
|
||||||
outer:
|
outer:
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var cache = caches[0];
|
var cache = caches[0];
|
||||||
value = array[index];
|
value = array[index];
|
||||||
|
|
||||||
if ((cache ? cacheIndexOf : indexOf)(cache || seen, value) < 0) {
|
if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
|
||||||
argsIndex = argsLength;
|
argsIndex = argsLength;
|
||||||
seen.push(value);
|
(cache || seen).push(value);
|
||||||
while (--argsIndex) {
|
while (--argsIndex) {
|
||||||
cache = caches[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;
|
continue outer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user