Skip to content

Commit

Permalink
tls: use optional chaining to simplify checks
Browse files Browse the repository at this point in the history
PR-URL: #41337
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
  • Loading branch information
aduh95 authored and danielleadams committed Feb 1, 2022
1 parent a136d56 commit 00abb81
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/internal/tls/secure-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,9 @@ function configSecureContext(context, options = {}, name = 'options') {
for (let i = 0; i < key.length; ++i) {
const val = key[i];
const pem = (
val !== undefined && val !== null &&
val.pem !== undefined ? val.pem : val);
val?.pem !== undefined ? val.pem : val);
const pass = (
val !== undefined && val !== null &&
val.passphrase !== undefined ? val.passphrase : passphrase);
val?.passphrase !== undefined ? val.passphrase : passphrase);
setKey(context, pem, pass, name);
}
} else {
Expand Down

0 comments on commit 00abb81

Please sign in to comment.