Skip to content

Commit

Permalink
errors: remove dead code in ERR_INVALID_ARG_TYPE
Browse files Browse the repository at this point in the history
Remove unreachable code. As expected is converted to an Array the
'not ' check will be never executed.
  • Loading branch information
Flarna committed Jan 11, 2020
1 parent 2a94c9f commit 91e2ce2
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,14 +946,7 @@ E('ERR_INVALID_ARG_TYPE',
const type = name.includes('.') ? 'property' : 'argument';
msg += `"${name}" ${type} `;
}

// determiner: 'must be' or 'must not be'
if (typeof expected === 'string' && expected.startsWith('not ')) {
msg += 'must not be ';
expected = expected.replace(/^not /, '');
} else {
msg += 'must be ';
}
msg += 'must be ';

const types = [];
const instances = [];
Expand Down

0 comments on commit 91e2ce2

Please sign in to comment.