Skip to content

Commit

Permalink
Make password property definitions consistent
Browse files Browse the repository at this point in the history
in formatting and configurability.
  • Loading branch information
charmander committed Jan 13, 2020
1 parent a8c8af9 commit fd53cf0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/pg-pool/index.js
Expand Up @@ -61,14 +61,14 @@ class Pool extends EventEmitter {
super()
this.options = Object.assign({}, options)

if ('password' in options) {
if (options != null && 'password' in options) {
// "hiding" the password so it doesn't show up in stack traces
// or if the client is console.logged
Object.defineProperty(this.options, 'password', {
configurable: true,
enumerable: false,
value: options.password,
writable: true
writable: true,
value: options.password
})
}

Expand Down
5 changes: 2 additions & 3 deletions packages/pg/lib/client.js
Expand Up @@ -33,12 +33,11 @@ var Client = function (config) {

// "hiding" the password so it doesn't show up in stack traces
// or if the client is console.logged
const password = this.connectionParameters.password
Object.defineProperty(this, 'password', {
configurable: true,
enumerable: false,
configurable: false,
writable: true,
value: password
value: this.connectionParameters.password
})

this.replication = this.connectionParameters.replication
Expand Down
5 changes: 2 additions & 3 deletions packages/pg/lib/connection-parameters.js
Expand Up @@ -57,12 +57,11 @@ var ConnectionParameters = function (config) {

// "hiding" the password so it doesn't show up in stack traces
// or if the client is console.logged
const password = val('password', config)
Object.defineProperty(this, 'password', {
configurable: true,
enumerable: false,
configurable: false,
writable: true,
value: password
value: val('password', config)
})

this.binary = val('binary', config)
Expand Down

0 comments on commit fd53cf0

Please sign in to comment.