Skip to content

Commit

Permalink
doc: clarify treatment of non-string argument to new URL()
Browse files Browse the repository at this point in the history
Closes: nodejs#41653
  • Loading branch information
Trott committed Jan 23, 2022
1 parent a96549a commit 39d4529
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ return `true`.

#### `new URL(input[, base])`

* `input` {string} The absolute or relative input URL to parse. If `input`
* `input` {any} The absolute or relative input URL to parse. If `input`
is relative, then `base` is required. If `input` is absolute, the `base`
is ignored.
is ignored. If `input` is not a string, it is [converted to a string][] first.
* `base` {string|URL} The base URL to resolve against if the `input` is not
absolute.

Expand Down Expand Up @@ -1681,6 +1681,7 @@ console.log(myURL.origin);
[Punycode]: https://tools.ietf.org/html/rfc5891#section-4.4
[WHATWG URL]: #the-whatwg-url-api
[WHATWG URL Standard]: https://url.spec.whatwg.org/
[converted to a string]: https://tc39.es/ecma262/#sec-tostring
[`Error`]: errors.md#class-error
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
[`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
Expand Down

0 comments on commit 39d4529

Please sign in to comment.