Skip to content

Commit e4b158b

Browse files
committed
Allow a falsy url string
1 parent 989ec55 commit e4b158b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ function parseOptions(a, b) {
427427
return a
428428

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

530530
function parseUrl(url) {
531-
if (typeof url !== 'string')
531+
if (!url || typeof url !== 'string')
532532
return { url: { searchParams: new Map() } }
533533

534534
let host = url

0 commit comments

Comments
 (0)