From 7231090a5dc44221d3c4f40300367cf709f90938 Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich <18708370+Flarna@users.noreply.github.com> Date: Sat, 11 Jan 2020 22:55:24 +0100 Subject: [PATCH] errors: remove dead code in ERR_INVALID_ARG_TYPE Remove unreachable code. As expected is converted to an Array the 'not ' check will be never executed. PR-URL: https://github.com/nodejs/node/pull/31322 Reviewed-By: Ruben Bridgewater Reviewed-By: Yongsheng Zhang Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- lib/internal/errors.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 724701635d670c..8020042d2ab609 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -941,14 +941,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 = [];