diff options
Diffstat (limited to 'cli/js/web/url.ts')
-rw-r--r-- | cli/js/web/url.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/js/web/url.ts b/cli/js/web/url.ts index 77285e456..6a8dc6627 100644 --- a/cli/js/web/url.ts +++ b/cli/js/web/url.ts @@ -193,10 +193,10 @@ export class URLImpl implements URL { // https://url.spec.whatwg.org/#port-state if (value === "") return value; - const port = parseInt(value, 10); - - if (!Number.isNaN(port) && port > 0 && port <= MAX_PORT) + const port = Number(value); + if (Number.isInteger(port) && port >= 0 && port <= MAX_PORT) { return port.toString(); + } return undefined; }; |