Skip to content

Commit

Permalink
errors: replace .split() with .replace()
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
Trott authored and BridgeAR committed Sep 24, 2017
1 parent cef6e1c commit 55d49eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit 55d49eb

Please sign in to comment.