We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent acc0546 commit 28a2088Copy full SHA for 28a2088
lib/index.js
@@ -447,9 +447,9 @@ function Postgres(url, options) {
447
}
448
449
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: '' }
+ const env = process.env // eslint-disable-line
+ , url = typeof uri === 'string' ? Url.parse(uri, true) : { query: {}, pathname: '' }
+ , o = (typeof uri === 'string' ? options : uri) || {}
453
, auth = (url.auth || '').split(':')
454
, host = o.hostname || o.host || url.hostname || env.PGHOST || 'localhost'
455
, port = o.port || url.port || env.PGPORT || 5432
0 commit comments