Skip to content

Commit

Permalink
fix: revert magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
nigrosimone committed Jan 18, 2025
1 parent 5262ee0 commit 2fec476
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

// eslint-disable-next-line
const STR_ESCAPE = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/
const MAGIC_NUMBER = 42

module.exports = class Serializer {
constructor (options) {
Expand Down Expand Up @@ -93,7 +92,7 @@ module.exports = class Serializer {

asString (str) {
const len = str.length
if (len < MAGIC_NUMBER) {
if (len < 42) {
// magically escape strings for json
// relying on their charCodeAt
// everything below 32 needs JSON.stringify()
Expand Down

0 comments on commit 2fec476

Please sign in to comment.