requireURL()function
requireURL(target: PossibleURL, base?: PossibleURL, caller: AnyCaller = requireURL): ImmutableURL
| Param | Type | |
|---|---|---|
target | PossibleURL | URL string, URL object, or path to resolve. required |
base | PossibleURL | Base URL to resolve a relative target against. |
caller | AnyCaller | Function to attribute a thrown error to — defaults to requireURL. Defaults to requireURL |
| Return | |
|---|---|
ImmutableURL | Resolved ImmutableURL. |
| Throws | |
|---|---|
unknown | RequiredError If target cannot be resolved to a true scheme://host URL. |
Convert a possible URL to a URL, or throw RequiredError if conversion fails.
Examples
requireURL("/page", "http://example.com/"); // `http://example.com/page`