requireURL()function

requireURL(target: PossibleURL, base?: PossibleURL, caller: AnyCaller = requireURL): ImmutableURL
ParamType
targetPossibleURL
URL string, URL object, or path to resolve. required
basePossibleURL
Base URL to resolve a relative target against.
callerAnyCaller
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`