Skip to content

Commit fd319d3

Browse files
committed
control: fix check if argument is number
Number.isNaN("colour") returns false so things break. +"colour" is NaN so Number.isNaN(+"colour") returns true and things work. Style checker requires that +x be spelled Number(x). Signed-off-by: Peter A. Bigot <[email protected]>
1 parent 1cb3bfb commit fd319d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/control.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function parseConfig(config, options) {
77
c.badArgument(options);
88
}
99

10-
if (Number.isNaN(options.protocolVersion)) {
10+
if (Number.isNaN(Number(options.protocolVersion))) {
1111
c.badArgument(options);
1212
}
1313

@@ -66,7 +66,7 @@ async function set(config, options) {
6666
}
6767

6868
if (!options.rawValue) {
69-
if (!Number.isNaN(options.set)) {
69+
if (!Number.isNaN(Number(options.set))) {
7070
options.set = Number.parseInt(options.set, 10);
7171
} else if (options.set.toLowerCase() === 'true') {
7272
options.set = true;

0 commit comments

Comments
 (0)