From 32fdfcc1e56885e14c12da9da28d4a8c2df9a7e5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 21 Dec 2016 12:33:46 -0600 Subject: [PATCH] =?UTF-8?q?Avoid=20coercing=20`position`=20in=20`=5F.start?= =?UTF-8?q?sWith`,=20if=20it=E2=80=99s=20`undefined`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lodash.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lodash.js b/lodash.js index b60c9ed6e..97808d92c 100644 --- a/lodash.js +++ b/lodash.js @@ -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; }