Uri

Methods

(static) appendFragment(that, fragment) → {string}

Use to append fragment.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
fragment string | UriObj Encoded string or key-value object.
Returns:
Modified copy of `that`.
Type
string

(static) appendQuery(that, query) → {string}

Use to append query.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
query string | UriObj Encoded string or unencoded key-value object.
Returns:
Modified copy of `that`.
Type
string

(static) appendSegments(that, segments) → {string}

Use to append path segments.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
segments Array.<string> | string Array or multiple arguments of unencoded path segments.
Returns:
Modified copy of `that`.
Type
string

(static) convertToFolder(that) → {string}

Use to convert URI path to folder.

Source:
Example
Uri.convertToFolder('/samples/ui/test/aam-test');	// 	'/samples/ui/test/'
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that` ending with '/'.
Type
string

(static) denotesFolder(that) → {boolean}

Use to test if path ends with '/'.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Type
boolean

(static) equals(that1, that2, ignoreFragment) → {boolean}

Use to test if URIs are equal. Order of query params is ignored.

Source:
Parameters:
Name Type Description
that1 string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
that2 string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
ignoreFragment boolean When true, fragment (hash) is ignored when determining equality.\
Returns:
True if URIs are equal, false otherwise.
Type
boolean

(static) getAuthority(that) → {string|undefined}

Use instead of location.host.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Type
string | undefined

(static) getFragment(that) → {string|undefined}

Use instead of location.hash.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
String without '#' delimiter.
Type
string | undefined

(static) getHost(that) → {string|undefined}

Use instead of location.hostname.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Type
string | undefined

(static) getLastSegment(that) → {string}

Use to get the last path segment.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Empty string when `that` denotes folder, `undefined` if path is empty.
Type
string

(static) getPath(that) → {string|undefined}

Use instead of location.search.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
String starting by '/'.
Type
string | undefined

(static) getPort(that) → {string|undefined}

Use instead of location.port.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Type
string | undefined

(static) getQuery(that, toObject) → {string|UriObj|undefined}

Use instead of location.search.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
toObject boolean If `true` query is returned as object.
Returns:
String without '?' delimiter or key-value object.
Type
string | UriObj | undefined

(static) getScheme(that) → {string|undefined}

Use instead of location.protocol

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
String without ':' delimiter.
Type
string | undefined

(static) getScreenPath(that) → {string}

Use to get path after context and before extension.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) getSegments(that) → {Array.<string>}

Use to get path segments.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Array of strings, last is '' if path denotes a folder.
Type
Array.<string>

(static) getUserInfo(that) → {string|undefined}

Use to get user info. No equivalent in location.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Type
string | undefined

(static) isSubordinate(that, ref) → {boolean}

Use to test if ref URI is subordiante of base URI.

Source:
Parameters:
Name Type Description
that string | UriObj | null Base URI. URI string or URI object. Current window URI used when null or undefined.
ref string | UriObj | null Ref URI. URI string or URI object. Current window URI used when null or undefined.
Returns:
True if `ref` is subordinate of `base`.
Type
boolean

(static) mixin(that, obj) → {string}

Use to set multiple URI parts at once.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
obj UriObj Available properties: `scheme`, `authority`, `userInfo`, `host`, `port`, `path`, `query`, `fragment`.
Returns:
Modified copy of `that`.
Type
string

(static) parseId(that) → {number}

Use to retrieve resource id from RESTful URI.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Id.
Type
number

(static) resolve(that, ref) → {string}

Use to resolve ref URI using base URI.

Source:
Parameters:
Name Type Description
that string | UriObj | null Base URI. URI string or URI object. Current window URI used when null or undefined.
ref string | UriObj | null Ref URI. URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) resolveAsSubordinate(that, ref) → {string}

Use to resolve ref URI as subordinate of base URI.

Source:
Parameters:
Name Type Description
that string | UriObj | null Base URI. URI string or URI object. Current window URI used when null or undefined.
ref string | UriObj | null Ref URI. URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) resolveSvcCtx(that) → {string}

Prepends SVC CTX PREFIX

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Type
string

(static) resolveUiCtx(that) → {string}

Prepends SVC CTX PREFIX

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Type
string

(static) setAuthority(that, authority) → {string}

Use to set authority.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
authority string Authority.
Returns:
Modified copy of `that`.
Type
string

(static) setFragment(that, fragment) → {string}

Use to set fragment.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
fragment string | UriObj Encoded string or key-value object.
Returns:
Modified copy of `that`.
Type
string

(static) setHost(that, host) → {string}

Use to set host.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
host string Host.
Returns:
Modified copy of `that`.
Type
string

(static) setPath(that, path) → {string}

Use to set path.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
path string Encoded path.
Returns:
Modified copy of `that`.
Type
string

(static) setPort(that, port) → {string}

Use to set port.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
port string Port.
Returns:
Modified copy of `that`.
Type
string

(static) setQuery(that, query) → {string}

Use to set query.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
query string | UriObj Encoded string or unencoded key-value object.
Returns:
Modified copy of `that`.
Type
string

(static) setScheme(that, scheme) → {string}

Use to set scheme.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
scheme string Scheme.
Returns:
Modified copy of `that`.
Type
string

(static) setSegments(that, segments) → {string}

Use to set segments.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
segments Array.<string> Array of unencoded path segments.
Returns:
Modified copy of `that`.
Type
string

(static) setUserInfo(that, userInfo) → {string}

Use to set user info.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
userInfo string User info.
Returns:
Modified copy of `that`.
Type
string

(static) strip(that, toStrip) → {string}

Use to strip some parts of URI.

Source:
Example
Uri.strip(uriStr, 'QUERY,FRAGMENT');
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
toStrip string Comma separated values, available are: 'ORIGIN', 'CTX', 'EXTENSION', 'QUERY', 'FRAGMENT'.
Returns:
Modified copy of `that`.
Type
string

(static) stripCtxPath(that) → {string}

Use to get path after context with query and fragment.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) stripCtxPrefix(that) → {string}

Use to get path after context prefix (UI or svc) with query and fragment.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) stripExtension(that) → {string}

Use to get uri without path extension.

Source:
Example
Uri.stripExtension('/samples/ui/test/aam-test.standalone'); // '/samples/ui/test/aam-test'
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) stripFragment(that) → {string}

Use to get URI without fragment.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) stripOrigin(that) → {string}

Use to get path with query and fragment.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) stripPath(that) → {string}

Use to get origin, i.e. everything before path.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) stripQuery(that) → {string}

Use to get URI without query.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
Modified copy of `that`.
Type
string

(static) toString(that) → {string}

Use to convert uri object to string.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
URI string.
Type
string

(static) toUri(that) → {UriObj}

Use to convert uri to uri object.

Source:
Parameters:
Name Type Description
that string | UriObj | null URI string or URI object. Current window URI used when null or undefined.
Returns:
URI object with properties: `scheme`, `authority`, `userInfo`, `host`, `port`, `path`, `query`, `fragment`.
Type
UriObj

Type Definitions

UriObj

Source:
Properties:
Name Type Description
scheme string
host string
port string
userInfo string
authority string
path string
query string
fragment string
Type:
  • object