Use a nullish check in _.startsWith instead of typeof.

This commit is contained in:
John-David Dalton
2014-12-31 00:43:18 -06:00
parent 670358f235
commit a302ca3d6c

View File

@@ -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;
}