mirror of https://github.com/nodejs/node.git
errors: replace `.split()` with `.replace()`
Replace a somewhat idiosyncratic use of `split()` to remove a prefix with `replace()`. (A case could be made for `slice()` as well but I think this is more readable.) PR-URL: https://github.com/nodejs/node/pull/15545 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
cef6e1c55f
commit
55d49eb3cc
|
@ -311,7 +311,7 @@ function invalidArgType(name, expected, actual) {
|
|||
let determiner;
|
||||
if (typeof expected === 'string' && expected.startsWith('not ')) {
|
||||
determiner = 'must not be';
|
||||
expected = expected.split('not ')[1];
|
||||
expected = expected.replace(/^not /, '');
|
||||
} else {
|
||||
determiner = 'must be';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue