We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03f17c2 commit 8474a98Copy full SHA for 8474a98
HISTORY.md
@@ -1,3 +1,7 @@
1
+Unreleased
2
+=========================
3
+* refactor(json): simplify strict mode error string construction
4
+
5
2.2.1 / 2025-11-24
6
=========================
7
lib/types/json.js
@@ -102,11 +102,7 @@ function createStrictSyntaxError (str, char) {
102
var partial = ''
103
104
if (index !== -1) {
105
- partial = str.substring(0, index) + JSON_SYNTAX_CHAR
106
-
107
- for (var i = index + 1; i < str.length; i++) {
108
- partial += JSON_SYNTAX_CHAR
109
- }
+ partial = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index)
110
}
111
112
try {
0 commit comments