Represents a URI.

Constructors

  • Creates a new Uri object.

    Parameters

    • Optionaluri: string

      An optional string representation of a URI to build from.

    Returns Uri

Properties

fragment: string

The fragment, also known as the hash.

host: string

The host name.

password: string

The user password.

path: string

The path.

port: string

The port.

queryValues: Map<string | number, string> = ...

Maps individual query parameters to query values. Values that don't have a key can be accessed by numeric index. The nth such query parameter will have key n (counting starts at 0). So for "?foo=1&bar&baz", queryValues will be [["foo", 1], [0, "bar"], [1, "baz"]].

scheme: string

The scheme of the URI (also known as protocol). E.g. "http", "ftp", etc.

user: string

The user name.

Accessors

  • get authority(): string
  • The authority, i.e. the combination of user info, host, and port.

    Returns string

  • get isAbsolute(): boolean
  • Determines whether this URI is absolute.

    Returns boolean

  • get isRelative(): boolean
  • Determines whether this URI is relative.

    Returns boolean

  • get query(): string
  • The full query string.

    Returns string

  • set query(value): void
  • Parameters

    • value: string

    Returns void

Methods

  • Creates a deep copy of this URI.

    Returns Uri

  • Attempts to converts a URI into an absolute URI.

    Parameters

    • baseUri: string | Uri

      The base URI that acts as the context for a relative URI.

    Returns Uri

    A new Uri object that represents the transformation of the the current URI in relation to baseUri. The algorithm follows the one outlined in RFC-3986 section 5.2.2. Note that the result might not actually be an absolute URI if baseUri is not itself absolute.

  • Returns the string representation of this URI.

    Returns string