Uri

nge. Uri

new Uri(repo, pathopt)

Repository URI.
Parameters:
Name Type Attributes Description
repo string | nge.Uri The repository identifier or nge.Uri instance.
path string <optional>
The repository path.

Methods

(static) fromStreamUrl(str) → (nullable) {nge.Uri}

Returns URI parsed from stream URL.
Parameters:
Name Type Description
str string | nge.Url The string or URL.
Returns:
The URI instance.
Type
nge.Uri

(static) parse(str) → (nullable) {nge.Uri}

Parses string representation of an URI.
Parameters:
Name Type Description
str string The URI string.
Returns:
The URI or null if invalid URI.
Type
nge.Uri

(static) validateName(str, messagesopt) → {boolean}

Validates repository object name.
Parameters:
Name Type Attributes Description
str string The string.
messages Array <optional>
The output error messages.
Returns:
true if string is valid name, false otherwise.
Type
boolean

combine(path) → {nge.Uri}

Combines URI with path.
Parameters:
Name Type Description
path string The path to combine.
Returns:
The combined URI.
Type
nge.Uri

encodedPath() → {string}

Returns URL encoded path.
Returns:
URL encoded path.
Type
string

isAbsolute() → {boolean}

Determines whether URI is absolute. The URI is absolute if, and only if, it has repository defined.
Returns:
true if URI is absolute, false otherwise.
Type
boolean

isParentOf(uri) → {boolean}

Determines whether this URI can be considered a parent of uri.
Parameters:
Name Type Description
uri string | nge.Uri The URI.
Returns:
true or false.
Type
boolean

pageUrl() → (nullable) {string}

Returns URL of a page. The URI must point to a repository view document.
Returns:
The URL or null if URL cannot be constructed.
Type
string

relativize(uri) → (nullable) {nge.Uri}

Relativizes the given URI against this URI.
Parameters:
Name Type Description
uri nge.Uri | string The URI to be relativized.
Returns:
The resulting URI or null if given URI is null or invalid.
Type
nge.Uri

resolve(uri) → (nullable) {nge.Uri}

Resolves the given URI against this URI.
Parameters:
Name Type Description
uri nge.Uri | string The URI to be resolved.
Returns:
The resulting URI or null if given URI is null or invalid.
Type
nge.Uri

streamUrl(langopt, renditionopt) → {string}

Returns URL of a stream.
Parameters:
Name Type Attributes Description
lang string <optional>
The language tag.
rendition string <optional>
The rendition name.
Returns:
URL
Type
string

toString() → {string}

Returns string representation of URI.
Returns:
the URI string.
Type
string