File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -691,6 +691,23 @@ const isValid = URL.canParse('/foo', 'https://example.org/'); // true
691
691
const isNotValid = URL .canParse (' /foo' ); // false
692
692
```
693
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
+
694
711
### Class: ` URLSearchParams `
695
712
696
713
<!-- YAML
You can’t perform that action at this time.
0 commit comments