Skip to content

Commit

Permalink
console: remove unreachable code
Browse files Browse the repository at this point in the history
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: #26863
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
Trott authored and targos committed Mar 27, 2019
1 parent 3cae010 commit f263f98
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down

0 comments on commit f263f98

Please sign in to comment.