Skip to content

Commit

Permalink
ensure node support since node 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Jan 6, 2025
1 parent 4f6922a commit 1fdf74c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
with:
license-check: true
lint: true
node-versions: '["16", "18", "20", "22"]'
node-versions: '["10", "12", "14", "16", "18", "20", "22"]'
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function serialize (cmpts, opts) {
const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()]

// perform scheme specific serialization
if (schemeHandler?.serialize) schemeHandler.serialize(components, options)
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options)

if (components.path !== undefined) {
if (!options.skipEscape) {
Expand Down Expand Up @@ -252,7 +252,7 @@ function parse (uri, opts) {
// check if scheme can't handle IRIs
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
// if host component is a domain name
if (parsed.host && (options.domainHost || schemeHandler?.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
// convert Unicode IDN -> ASCII IDN
try {
parsed.host = URL.domainToASCII(parsed.host.toLowerCase())
Expand All @@ -270,16 +270,16 @@ function parse (uri, opts) {
if (gotEncoding && parsed.host !== undefined) {
parsed.host = unescape(parsed.host)
}
if (parsed.path?.length) {
if (parsed.path && parsed.path.length) {
parsed.path = escape(unescape(parsed.path))
}
if (parsed.fragment?.length) {
if (parsed.fragment && parsed.fragment.length) {
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment))
}
}

// perform scheme specific parsing
if (schemeHandler?.parse) {
if (schemeHandler && schemeHandler.parse) {
schemeHandler.parse(parsed, options)
}
} else {
Expand Down

0 comments on commit 1fdf74c

Please sign in to comment.