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 ad325d8 commit 7f48cb6Copy full SHA for 7f48cb6
lib/serializer.js
@@ -1,8 +1,5 @@
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) {
@@ -117,7 +114,7 @@ module.exports = class Serializer {
117
114
}
118
115
119
116
return (last === -1 && ('"' + str + '"')) || ('"' + result + str.slice(last) + '"')
120
- } else if (len < 5000 && STR_ESCAPE.test(str) === false) {
+ } else if (len < 5000 && str.isWellFormed()) {
121
// Only use the regular expression for shorter input. The overhead is otherwise too much.
122
return '"' + str + '"'
123
} else {
0 commit comments