tls: use optional chaining to simplify checks

PR-URL: https://github.com/nodejs/node/pull/41337
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
Antoine du Hamel 2022-01-05 12:01:29 +01:00 committed by GitHub
parent 1344b36fe3
commit f34c0e0bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {