Skip to content

Commit 3c8b25b

Browse files
aduh95targos
authored andcommitted
tls: use optional chaining to simplify checks
PR-URL: #41337 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent e15e1cb commit 3c8b25b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/internal/tls/secure-context.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,9 @@ function configSecureContext(context, options = {}, name = 'options') {
161161
for (let i = 0; i < key.length; ++i) {
162162
const val = key[i];
163163
const pem = (
164-
val !== undefined && val !== null &&
165-
val.pem !== undefined ? val.pem : val);
164+
val?.pem !== undefined ? val.pem : val);
166165
const pass = (
167-
val !== undefined && val !== null &&
168-
val.passphrase !== undefined ? val.passphrase : passphrase);
166+
val?.passphrase !== undefined ? val.passphrase : passphrase);
169167
setKey(context, pem, pass, name);
170168
}
171169
} else {

0 commit comments

Comments
 (0)