Skip to content

Commit

Permalink
util: remove unreachable branch
Browse files Browse the repository at this point in the history
Re-defining the array length will always set to 0.
Hence, the code branch can not be covered.

PR-URL: nodejs#24447
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
rahulshuklab4u authored and refack committed Jan 10, 2019
1 parent c7d1fa7 commit 7a0d9d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/util/inspect.js
Expand Up @@ -475,7 +475,7 @@ function noPrototypeIterator(ctx, value, recurseTimes) {
} else if (Array.isArray(value)) {
const clazz = Object.getPrototypeOf(value) ||
clazzWithNullPrototype(Array, 'Array');
newVal = new clazz(value.length || 0);
newVal = new clazz(value.length);
} else if (isTypedArray(value)) {
let clazz = Object.getPrototypeOf(value);
if (!clazz) {
Expand Down

0 comments on commit 7a0d9d3

Please sign in to comment.