From f263f98d5a9b4fbcffa45c0217c69213ea36781c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 22 Mar 2019 10:07:29 -0700 Subject: [PATCH] console: remove unreachable code The current version of lib/internal/console/constructor.js includes this as part of line 470: setlike ? iterKey : indexKey However, `setlike` is guaranteed to be true because we are inside of an `if` block (starting on line 463) that explicitly checks that `setlike` is true. Coverage reporting confirms that `setliked` is always true when it is reached in our tests. Remove the ternary as the value provided will always be `iterKey`. PR-URL: https://github.com/nodejs/node/pull/26863 Reviewed-By: Colin Ihrig Reviewed-By: Beth Griggs Reviewed-By: Luigi Pinca Reviewed-By: Yongsheng Zhang --- lib/internal/console/constructor.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 7422efc13ab26a..9d8e14281e21a8 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -466,10 +466,7 @@ const consoleMethods = { values.push(inspect(v)); length++; } - return final([setlike ? iterKey : indexKey, valuesKey], [ - getIndexArray(length), - values, - ]); + return final([iterKey, valuesKey], [getIndexArray(length), values]); } const map = {};