Skip to content

Commit

Permalink
improve performance of strict
Browse files Browse the repository at this point in the history
  • Loading branch information
stepancar committed Aug 9, 2022
1 parent 1f6f58e commit 9a2356a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/types/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = json
* %x0D ) ; Carriage return
*/

var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
var FIRST_CHAR_REGEXP = /[^\x20\x09\x0a\x0d]/ // eslint-disable-line no-control-regex

/**
* Create a middleware to parse JSON bodies.
Expand Down Expand Up @@ -178,7 +178,7 @@ function firstchar (str) {
var match = FIRST_CHAR_REGEXP.exec(str)

return match
? match[1]
? match[0]
: undefined
}

Expand Down

0 comments on commit 9a2356a

Please sign in to comment.