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 targos committed Jan 14, 2022
1 parent e15e1cb commit 3c8b25b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/internal/tls/secure-context.js
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 3c8b25b

Please sign in to comment.