Skip to content

Commit 28a2088

Browse files
committed
Handle url + no options properly
1 parent acc0546 commit 28a2088

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,9 @@ function Postgres(url, options) {
447447
}
448448

449449
function parseOptions(uri = {}, options) {
450-
const o = options || uri
451-
, env = process.env // eslint-disable-line
452-
, url = options ? Url.parse(uri, true) : { query: {}, pathname: '' }
450+
const env = process.env // eslint-disable-line
451+
, url = typeof uri === 'string' ? Url.parse(uri, true) : { query: {}, pathname: '' }
452+
, o = (typeof uri === 'string' ? options : uri) || {}
453453
, auth = (url.auth || '').split(':')
454454
, host = o.hostname || o.host || url.hostname || env.PGHOST || 'localhost'
455455
, port = o.port || url.port || env.PGPORT || 5432

0 commit comments

Comments
 (0)