From 47ed512312100fd98058cb54ae3e1d46dca9beb5 Mon Sep 17 00:00:00 2001 From: raisinten Date: Fri, 15 Jan 2021 15:16:42 +0530 Subject: [PATCH] lib: refactor to use optional chaining in internal/options.js PR-URL: https://github.com/nodejs/node/pull/36939 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott --- lib/internal/options.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/internal/options.js b/lib/internal/options.js index 10c6aa2d9a0978..a1d4bd984c4881 100644 --- a/lib/internal/options.js +++ b/lib/internal/options.js @@ -6,11 +6,7 @@ const { options, aliases } = getOptions(); let warnOnAllowUnauthorized = true; function getOptionValue(option) { - const result = options.get(option); - if (!result) { - return undefined; - } - return result.value; + return options.get(option)?.value; } function getAllowUnauthorized() {