Skip to content

Commit

Permalink
Allow a falsy url string
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed Oct 10, 2023
1 parent 989ec55 commit e4b158b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ function parseOptions(a, b) {
return a

const env = process.env // eslint-disable-line
, o = (typeof a === 'string' ? b : a) || {}
, o = (!a || typeof a === 'string' ? b : a) || {}
, { url, multihost } = parseUrl(a)
, query = [...url.searchParams].reduce((a, [b, c]) => (a[b] = c, a), {})
, host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || 'localhost'
Expand Down Expand Up @@ -528,7 +528,7 @@ function parseTransform(x) {
}

function parseUrl(url) {
if (typeof url !== 'string')
if (!url || typeof url !== 'string')
return { url: { searchParams: new Map() } }

let host = url
Expand Down

0 comments on commit e4b158b

Please sign in to comment.