Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Uri.Absolute

import { Uri } from "https://raw.githubusercontent.com/i-xi-dev/url.es/3.1.21/mod.ts"; 

const { Absolute } = Uri;

The normalized absolute URL. The Absolute instances are immutable.

class Absolute {
private constructor(uri: URL);
get scheme(): Scheme;
get rawUserName(): string;
get rawPassword(): string;
get rawHost(): string;
get host(): string;
get port(): number;
get rawPath(): string;
get path(): Array<Uri.PathSegment>;
get rawQuery(): string;
get query(): Array<Uri.QueryParameter>;
get rawFragment(): string;
get fragment(): string;
get origin(): string;
 
hasCredentials(): boolean;
hasFragment(): boolean;
hasQuery(): boolean;
originEquals(other: Absolute | URL | string): boolean;
toJSON(): string;
toString(): string;
toURL(): URL;
withFragment(fragment: string): Absolute;
withoutCredentials(): Absolute;
withoutFragment(): Absolute;
withoutQuery(): Absolute;
withQuery(query: Array<Uri.QueryParameter>): Absolute;
 
static from(url: string | URL): Absolute;
static fromString(urlString: string): Absolute;
static fromURL(url: URL): Absolute;
}

§Constructors

§
new Absolute(uri: URL) private
[src]

§Properties

§
scheme: Scheme readonly
[src]

Gets the scheme name for this instance.

@example
const uri = Absolute.fromString("http://example.com/foo");
const scheme = uri.scheme;
// scheme
//   → "http"
§
rawUserName: string readonly
[src]

Gets the username for this instance.

§
rawPassword: string readonly
[src]

Gets the password for this instance.

§
rawHost: string readonly
[src]

Gets the host for this instance.

@example
const uri = Absolute.fromString("http://xn--eckwd4c7cu47r2wf.jp/foo");
const host = uri.rawHost;
// host
//   → "xn--eckwd4c7cu47r2wf.jp"
§
host: string readonly
[src]

Gets the decoded host for this instance.

@example
const uri = Absolute.fromString("http://xn--eckwd4c7cu47r2wf.jp/foo");
const punycodeDecodedHost = uri.host;
// punycodeDecodedHost
//   → "ドメイン名例.jp"
§
port: number readonly
[src]

Gets the port number for this instance.

If the port number is omitted, returns the number in below table.

scheme number
"ftp" 21
"http" 80
"https" 443
"ws" 80
"wss" 443
others NaN
@example
const uri = Absolute.fromString("http://example.com/foo");
const port = uri.port;
// port
//   → 80
@example
const uri = Absolute.fromString("http://example.com:8080/foo");
const port = uri.port;
// port
//   → 8080
§
rawPath: string readonly
[src]

Gets the path for this instance.

§
path: Array<Uri.PathSegment> readonly
[src]

Gets the path segments for this instance.

§
rawQuery: string readonly
[src]

Gets the query for this instance.

@example
const uri = Absolute.fromString("http://example.com/foo?p1=%E5%80%A41&p2=123");
const query = uri.rawQuery;
// query
//   → "p1=%E5%80%A41&p2=123"
§
query: Array<Uri.QueryParameter> readonly
[src]

Gets the result of parsing the query for this instance in the application/x-www-form-urlencoded format.

@example
const uri = Absolute.fromString("http://example.com/foo?p1=%E5%80%A41&p2=123");
const queryEntries = uri.query;
// queryEntries
//   → [ [ "p1", "値1" ], [ "p2", "123" ] ]
@example
const uri = Absolute.fromString("http://example.com/foo?textformat");
const queryEntries = uri.query;
// queryEntries
//   → [ [ "textformat", "" ] ]
§
rawFragment: string readonly
[src]

Gets the fragment for this instance.

@example
const uri = Absolute.fromString("http://example.com/foo#%E7%B4%A0%E7%89%87");
const fragment = uri.rawFragment;
// fragment
//   → "%E7%B4%A0%E7%89%87"
§
fragment: string readonly
[src]

Gets the decoded fragment for this instance.

@example
const uri = Absolute.fromString("http://example.com/foo#%E7%B4%A0%E7%89%87");
const percentDecodedFragment = uri.fragment;
// percentDecodedFragment
//   → "素片"
§
origin: string readonly
[src]

Gets the origin for this instance.

If this scheme is "blob", "ftp", "http", "https", "ws", "wss", the value of new URL(this.toString()).origin ; otherwise, "null".

§Methods

§
hasCredentials(): boolean
[src]

Returns whether this instance has a username or password.

@return

Whether this instance has a username or password.

§
hasFragment(): boolean
[src]

Returns whether this instance has a fragment.

@return

Whether this instance has a fragment.

@example
const uri = Absolute.fromString("http://example.com/foo#%E7%B4%A0%E7%89%87");
const uriHasFragment = uri.hasFragment();
// uriHasFragment
//   → true
§
hasQuery(): boolean
[src]

Returns whether this instance has query parameters.

@return

Whether this instance has query parameters.

@example
const uri = Absolute.fromString("http://example.com/foo?p1=%E5%80%A41&p2=123");
const uriHasQuery = uri.hasQuery();
// uriHasQuery
//   → true
§
originEquals(other: Absolute | URL | string): boolean
[src]

Determines whether this origin is equal to the origin of the absolute URL represented by another object.

@param other

An absolute URL.

@return

If this origin is equal to the origin of the specified absolute URL, true; otherwise, false.

§
toJSON(): string
[src]
@return

The normalized string representation for this instance.

§
toString(): string
[src]
@return

The normalized string representation for this instance.

§
toURL(): URL
[src]
@return

A new URL object.

§
withFragment(fragment: string): Absolute
[src]

Return a new Absolute instance with the fragment set.

@param fragment

The fragment. No need to prepend a "#" to fragment.

@return

A new Absolute instance.

@example
const uri = Absolute.fromString("http://example.com/foo");
const uriWithFragment = uri.withFragment("素片");
// uriWithFragment.toString()
//   → "http://example.com/foo#%E7%B4%A0%E7%89%87"
@example
const uri = Absolute.fromString("http://example.com/foo#%E7%B4%A0%E7%89%87");
const uriWithFragment = uri.withFragment("svgView(viewBox(0,0,100,100))");
// uriWithFragment.toString()
//   → "http://example.com/foo#svgView(viewBox(0,0,100,100))"
§
withoutCredentials(): Absolute
[src]

Returns a new Absolute instance with the user and password removed.

@return

A new Absolute instance.

@example
const uri = Absolute.fromString("http://usr:pwd@example.com/foo");
const uriWithoutCredentials = uri.withoutCredentials();
// uriWithoutCredentials.toString()
//   → "http://example.com/foo"
§
withoutFragment(): Absolute
[src]

Returns a new Absolute instance with the fragment removed.

@return

A new Absolute instance.

@example
const uri = Absolute.fromString("http://example.com/foo#%E7%B4%A0%E7%89%87");
const uriWithoutFragment = uri.withoutFragment();
// uriWithoutFragment.toString()
//   → "http://example.com/foo"
§
withoutQuery(): Absolute
[src]

Returns a new Absolute instance with the query removed.

@return

A new Absolute instance.

@example
const uri = Absolute.fromString("http://example.com/foo?p1=%E5%80%A41&p2=123");
const uriWithoutQuery = uri.withoutQuery();
// uriWithoutQuery.toString()
//   → "http://example.com/foo"
§
withQuery(query: Array<Uri.QueryParameter>): Absolute
[src]

Return a new Absolute instance with the query set.

@param query

The query parameters.

@return

A new Absolute instance.

@example
const uri = Absolute.fromString("http://example.com/foo?p1=%E5%80%A41&p2=123");
const uriWithQuery = uri.withQuery([ [ "p1", "値1" ], [ "p2", "123" ] ]);
// uriWithQuery
//   → "http://example.com/foo?p1=%E5%80%A41&p2=123"
@example
const uri = Absolute.fromString("http://example.com/foo?p1=%E5%80%A41&p2=123");
const uriWithQuery = uri.withQuery([ [ "p1", "v1" ] ]);
// uriWithQuery
//   → "http://example.com/foo?p1=v1"

§Static Methods

§
from(url: string | URL): Absolute
[src]

Creates a new Absolute instance from the specified absolute URL.

@param url

A URL or string that represents an absolute URL.

@return

A Absolute instance.

§
fromString(urlString: string): Absolute
[src]

Creates a new Absolute instance from the specified string representation of an absolute URL.

@param urlString

A string representing an absolute URL.

@return

A Absolute instance.

§
fromURL(url: URL): Absolute
[src]

Creates a new Absolute instance from the specified URL.

@param url

A URL.

@return

A Absolute instance.