Class URLParser
Index
Constructors
Methods
Methods
Static
parse
- parse(options: { base?: string; routePrefix?: string; url: string | URL }): URL
Parses a URL string converting it to a fully qualified URL. If URL is an existing URL instance it is returned immediately. Optionally you may construct a fully qualified URL from a relative base origin / path or with a route prefix added to the current location origin.
Parameters
- options: { base?: string; routePrefix?: string; url: string | URL }
Options.
Optional
base?: stringOptional fully qualified base path for relative URL construction.
Optional
routePrefix?: stringOptional route prefix to add to location origin for absolute URL strings when
base
is not defined.url: string | URL
URL string to convert to a URL.
Returns URL
Parsed URL or null if
url
is not parsed.- options: { base?: string; routePrefix?: string; url: string | URL }
Provides a utility function to parse / construct fully qualified URL instances from a URL string.