Skip to content

Commit ab89f0a

Browse files
anonrigaduh95
authored andcommitted
url: add missing documentation for URL.parse()
PR-URL: #53733 Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 5177714 commit ab89f0a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/api/url.md

+17
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,23 @@ const isValid = URL.canParse('/foo', 'https://example.org/'); // true
691691
const isNotValid = URL.canParse('/foo'); // false
692692
```
693693

694+
#### `URL.parse(input[, base])`
695+
696+
<!-- YAML
697+
added: v22.1.0
698+
-->
699+
700+
* `input` {string} The absolute or relative input URL to parse. If `input`
701+
is relative, then `base` is required. If `input` is absolute, the `base`
702+
is ignored. If `input` is not a string, it is [converted to a string][] first.
703+
* `base` {string} The base URL to resolve against if the `input` is not
704+
absolute. If `base` is not a string, it is [converted to a string][] first.
705+
* Returns: {URL|null}
706+
707+
Parses a string as a URL. If `base` is provided, it will be used as the base
708+
URL for the purpose of resolving non-absolute `input` URLs. Returns `null`
709+
if `input` is not a valid.
710+
694711
### Class: `URLSearchParams`
695712

696713
<!-- YAML

0 commit comments

Comments
 (0)