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 71c0174 commit ed75e11Copy full SHA for ed75e11
lib/serializer.js
@@ -1,5 +1,8 @@
1
'use strict'
2
3
+// eslint-disable-next-line
4
+const STR_ESCAPE = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/
5
+
6
module.exports = class Serializer {
7
constructor (options) {
8
switch (options && options.rounding) {
@@ -116,7 +119,7 @@ module.exports = class Serializer {
116
119
}
117
120
118
121
return (last === -1 && ('"' + str + '"')) || ('"' + result + str.slice(last) + '"')
- } else if (len < 5000 && str.isWellFormed()) {
122
+ } else if (len < 5000 && STR_ESCAPE.test(str) === false) {
123
// Only use the regular expression for shorter input. The overhead is otherwise too much.
124
return '"' + str + '"'
125
} else {
0 commit comments