From a302ca3d6c31122b9db0ec912146199f9a6d7821 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 31 Dec 2014 00:43:18 -0600 Subject: [PATCH] Use a nullish check in `_.startsWith` instead of `typeof`. --- lodash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodash.js b/lodash.js index df1143462..772928fa7 100644 --- a/lodash.js +++ b/lodash.js @@ -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; }