From 403efa1908a5c5d0ce0e0dbd21db5c9ec77229ec Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 27 Dec 2021 15:26:11 +0100 Subject: [PATCH] tls: use optional chaining to simplify checks --- lib/internal/tls/secure-context.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/internal/tls/secure-context.js b/lib/internal/tls/secure-context.js index d5a447adde84b3..8cb3ae06d2e2e1 100644 --- a/lib/internal/tls/secure-context.js +++ b/lib/internal/tls/secure-context.js @@ -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 {