mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Exit early from _.contains if length is 0 to avoid potentially mucking up getIndexOf by passing it an undefined collection.
This commit is contained in:
@@ -4712,6 +4712,9 @@
|
|||||||
collection = values(collection);
|
collection = values(collection);
|
||||||
length = collection.length;
|
length = collection.length;
|
||||||
}
|
}
|
||||||
|
if (!length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (typeof fromIndex == 'number') {
|
if (typeof fromIndex == 'number') {
|
||||||
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
|
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user