Skip to content

Commit 1e3fd64

Browse files
authored
chore: prefer charCodeAt (#384)
1 parent aa96bdb commit 1e3fd64

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function Router (opts) {
7979
assert(typeof opts.querystringParser === 'function', 'querystringParser must be a function')
8080
this.querystringParser = opts.querystringParser
8181
} else {
82-
this.querystringParser = (query) => query === '' ? {} : querystring.parse(query)
82+
this.querystringParser = (query) => query.length === 0 ? {} : querystring.parse(query)
8383
}
8484

8585
this.caseSensitive = opts.caseSensitive === undefined ? true : opts.caseSensitive
@@ -792,15 +792,15 @@ function getClosingParenthensePosition (path, idx) {
792792
while (idx < path.length) {
793793
idx++
794794

795-
// ignore skipped chars
796-
if (path[idx] === '\\') {
795+
// ignore skipped chars "\"
796+
if (path.charCodeAt(idx) === 92) {
797797
idx++
798798
continue
799799
}
800800

801-
if (path[idx] === ')') {
801+
if (path.charCodeAt(idx) === 41) {
802802
parentheses--
803-
} else if (path[idx] === '(') {
803+
} else if (path.charCodeAt(idx) === 40) {
804804
parentheses++
805805
}
806806

0 commit comments

Comments
 (0)