From eef741c8ab82e7dfd39967e89ca6d7961c1ecc9a Mon Sep 17 00:00:00 2001 From: James George Date: Fri, 17 Jan 2020 15:01:44 +0530 Subject: [PATCH] refactor: use startsWith --- lib/core/src/server/presets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/src/server/presets.js b/lib/core/src/server/presets.js index 03d090bd1586..2718c814407c 100644 --- a/lib/core/src/server/presets.js +++ b/lib/core/src/server/presets.js @@ -15,7 +15,7 @@ function parsePackageName(input) { throw new TypeError('Expected a string'); } - const matched = input.charAt(0) === '@' ? input.match(RE_SCOPED) : input.match(RE_NORMAL); + const matched = input.startsWith('@') ? input.match(RE_SCOPED) : input.match(RE_NORMAL); if (!matched) { throw new Error(`[parse-package-name] "${input}" is not a valid string`);