Use less ambiguous funcion
This commit is contained in:
@@ -30,7 +30,7 @@ function parseListenAddress(listen: string | undefined): {
|
|||||||
if (lastColon === -1) {
|
if (lastColon === -1) {
|
||||||
// Just a port number
|
// Just a port number
|
||||||
const port = parseInt(listen, 10);
|
const port = parseInt(listen, 10);
|
||||||
if (isNaN(port)) {
|
if (Number.isNaN(port)) {
|
||||||
throw new Error(`Invalid listen address: ${listen}`);
|
throw new Error(`Invalid listen address: ${listen}`);
|
||||||
}
|
}
|
||||||
return { host: defaultHost, port };
|
return { host: defaultHost, port };
|
||||||
@@ -39,7 +39,7 @@ function parseListenAddress(listen: string | undefined): {
|
|||||||
const host = listen.slice(0, lastColon);
|
const host = listen.slice(0, lastColon);
|
||||||
const port = parseInt(listen.slice(lastColon + 1), 10);
|
const port = parseInt(listen.slice(lastColon + 1), 10);
|
||||||
|
|
||||||
if (isNaN(port)) {
|
if (Number.isNaN(port)) {
|
||||||
throw new Error(`Invalid port in listen address: ${listen}`);
|
throw new Error(`Invalid port in listen address: ${listen}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user