mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Use a nullish check in _.startsWith instead of typeof.
This commit is contained in:
@@ -9521,7 +9521,7 @@
|
||||
*/
|
||||
function startsWith(string, target, position) {
|
||||
string = string == null ? '' : String(string);
|
||||
position = typeof position == 'undefined' ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length);
|
||||
position = position == null ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length);
|
||||
return string.lastIndexOf(target, position) == position;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user