Skip to content

Commit 63ec056

Browse files
committed
build
1 parent 31f9856 commit 63ec056

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

cf/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ function parseOptions(a, b) {
428428
return a
429429

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

531531
function parseUrl(url) {
532-
if (typeof url !== 'string')
532+
if (!url || typeof url !== 'string')
533533
return { url: { searchParams: new Map() } }
534534

535535
let host = url

cjs/src/index.js

Lines changed: 2 additions & 2 deletions
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

cjs/tests/bootstrap.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
const { spawnSync } = require('child_process')
22

3+
exec('dropdb', ['postgres_js_test'])
4+
35
exec('psql', ['-c', 'alter system set ssl=on'])
6+
exec('psql', ['-c', 'drop user postgres_js_test'])
47
exec('psql', ['-c', 'create user postgres_js_test'])
58
exec('psql', ['-c', 'alter system set password_encryption=md5'])
69
exec('psql', ['-c', 'select pg_reload_conf()'])
10+
exec('psql', ['-c', 'drop user if exists postgres_js_test_md5'])
711
exec('psql', ['-c', 'create user postgres_js_test_md5 with password \'postgres_js_test_md5\''])
812
exec('psql', ['-c', 'alter system set password_encryption=\'scram-sha-256\''])
913
exec('psql', ['-c', 'select pg_reload_conf()'])
14+
exec('psql', ['-c', 'drop user if exists postgres_js_test_scram'])
1015
exec('psql', ['-c', 'create user postgres_js_test_scram with password \'postgres_js_test_scram\''])
1116

12-
exec('dropdb', ['postgres_js_test'])
1317
exec('createdb', ['postgres_js_test'])
1418
exec('psql', ['-c', 'grant all on database postgres_js_test to postgres_js_test'])
1519
exec('psql', ['-c', 'alter database postgres_js_test owner to postgres_js_test'])

deno/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ function parseOptions(a, b) {
428428
return a
429429

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

531531
function parseUrl(url) {
532-
if (typeof url !== 'string')
532+
if (!url || typeof url !== 'string')
533533
return { url: { searchParams: new Map() } }
534534

535535
let host = url

deno/tests/bootstrap.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import { spawn } from 'https://deno.land/std@0.132.0/node/child_process.ts'
22

3+
await exec('dropdb', ['postgres_js_test'])
4+
35
await exec('psql', ['-c', 'alter system set ssl=on'])
6+
await exec('psql', ['-c', 'drop user postgres_js_test'])
47
await exec('psql', ['-c', 'create user postgres_js_test'])
58
await exec('psql', ['-c', 'alter system set password_encryption=md5'])
69
await exec('psql', ['-c', 'select pg_reload_conf()'])
10+
await exec('psql', ['-c', 'drop user if exists postgres_js_test_md5'])
711
await exec('psql', ['-c', 'create user postgres_js_test_md5 with password \'postgres_js_test_md5\''])
812
await exec('psql', ['-c', 'alter system set password_encryption=\'scram-sha-256\''])
913
await exec('psql', ['-c', 'select pg_reload_conf()'])
14+
await exec('psql', ['-c', 'drop user if exists postgres_js_test_scram'])
1015
await exec('psql', ['-c', 'create user postgres_js_test_scram with password \'postgres_js_test_scram\''])
1116

12-
await exec('dropdb', ['postgres_js_test'])
1317
await exec('createdb', ['postgres_js_test'])
1418
await exec('psql', ['-c', 'grant all on database postgres_js_test to postgres_js_test'])
1519
await exec('psql', ['-c', 'alter database postgres_js_test owner to postgres_js_test'])

0 commit comments

Comments
 (0)