mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Avoid coercing position in _.startsWith, if it’s undefined.
This commit is contained in:
@@ -14631,7 +14631,10 @@
|
||||
*/
|
||||
function startsWith(string, target, position) {
|
||||
string = toString(string);
|
||||
position = baseClamp(toInteger(position), 0, string.length);
|
||||
position = position === undefined
|
||||
? 0
|
||||
: baseClamp(toInteger(position), 0, string.length);
|
||||
|
||||
target = baseToString(target);
|
||||
return string.slice(position, position + target.length) == target;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user