Module: URLUtils

Provides utility functions for operating on URLs. Initially this is simply a method to determine the Base URL of a URL, but should probably include other things provided all over the place such as determining whether a URL is relative/absolute, resolving two paths etc.

Source:

Methods


isHTTPURL(url)

Determines whether the url is an HTTP-URL as defined in ISO/IEC 23009-1:2014 3.1.15. ie URL with a fixed scheme of http or https

Parameters:
Name Type Description
url string
Source:
Returns:
Type
bool

isPathAbsolute(url)

Determines whether the url is path-absolute.

Parameters:
Name Type Description
url string
Source:
Returns:
Type
bool

isRelative(url)

Determines whether the url is relative.

Parameters:
Name Type Description
url string
Source:
Returns:
Type
bool

parseBaseUrl(url)

Returns a string that contains the Base URL of a URL, if determinable.

Parameters:
Name Type Description
url string

full url

Source:
Returns:
Type
string

parseOrigin(url)

Returns a string that contains the scheme and origin of a URL, if determinable.

Parameters:
Name Type Description
url string

full url

Source:
Returns:
Type
string