Skip to content

Commit

Permalink
refactor(index): add u unicode flag to regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Oct 21, 2023
1 parent b5a1cb9 commit 13003ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function serialize (cmpts, opts) {
}

if (authority === undefined) {
s = s.replace(/^\/\//, '/%2F') // don't allow the path to start with "//"
s = s.replace(/^\/\//u, '/%2F') // don't allow the path to start with "//"
}

uriTokens.push(s)
Expand All @@ -178,7 +178,7 @@ function serialize (cmpts, opts) {
return uriTokens.join('')
}

const hexLookUp = Array.from({ length: 127 }, (v, k) => /[^!"$&'()*+,.;=_`a-z{}~-]/.test(String.fromCharCode(k)))
const hexLookUp = Array.from({ length: 127 }, (v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)))

function nonSimpleDomain (value) {
let code = 0
Expand All @@ -191,7 +191,7 @@ function nonSimpleDomain (value) {
return false
}

const URI_PARSE = /^(?:([^:/?#]+):)?(?:\/\/((?:([^/?#@]*)@)?(\[[^/?#\]]+\]|[^/?#:]*)(?::(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u

function parse (uri, opts) {
const options = Object.assign({}, opts)
Expand Down

0 comments on commit 13003ab

Please sign in to comment.