We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
URL.parse()
1 parent 3ab8aba commit 1300169Copy full SHA for 1300169
1 file changed
doc/api/url.md
@@ -691,6 +691,23 @@ const isValid = URL.canParse('/foo', 'https://example.org/'); // true
691
const isNotValid = URL.canParse('/foo'); // false
692
```
693
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
711
### Class: `URLSearchParams`
712
713
<!-- YAML
0 commit comments