We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dfb627e commit d154bf5Copy full SHA for d154bf5
lib/serializer.js
@@ -101,7 +101,8 @@ module.exports = class Serializer {
101
asString (str) {
102
if (str.length < 42) {
103
return this.asStringSmall(str)
104
- } else if (STR_ESCAPE.test(str) === false) {
+ } else if (str.length < 5000 && STR_ESCAPE.test(str) === false) {
105
+ // Only use the regular expression for shorter input. The overhead is otherwise too much.
106
return '"' + str + '"'
107
} else {
108
return JSON.stringify(str)
0 commit comments