From c0a4be45e1383904235d68b7e681b450890396f4 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`. --- 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 b8f2ae29244f9c..1e9fcb42ba6e26 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -467,10 +467,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 = {};