Skip to content

Commit 1b6bb85

Browse files
committed
use slice instead of replace for better performance
1 parent f3514e0 commit 1b6bb85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/JsonParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class JsonParser {
1313
}
1414

1515
parse(source, state) {
16-
const data = parseJson(source.replace(/^\ufeff/, ""));
16+
const data = parseJson(source[0] === "\ufeff" ? source.slice(1) : source);
1717
state.module.buildInfo.jsonData = data;
1818
state.module.buildMeta.exportsType = "named";
1919
if (typeof data === "object" && data)

0 commit comments

Comments
 (0)