mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Ensure _.includes matches an empty string on empty strings. [closes #1275]
This commit is contained in:
@@ -6660,17 +6660,14 @@
|
||||
collection = values(collection);
|
||||
length = collection.length;
|
||||
}
|
||||
if (!length) {
|
||||
return false;
|
||||
}
|
||||
if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
|
||||
fromIndex = 0;
|
||||
} else {
|
||||
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
|
||||
}
|
||||
return (typeof collection == 'string' || !isArray(collection) && isString(collection))
|
||||
? (fromIndex < length && collection.indexOf(target, fromIndex) > -1)
|
||||
: (getIndexOf(collection, target, fromIndex) > -1);
|
||||
? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
|
||||
: (!!length && getIndexOf(collection, target, fromIndex) > -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user