Skip to content

URL ​

Parse and build URLs and query strings.

Always available

No import needed. These names are in scope in every file.

URLSearchParams class ​

ts
class URLSearchParams

Type only: the runtime hands you instances; you never construct it yourself.

Mutable, ordered query-string parameter list. Obtained from URL.searchParams; mutating it rewrites the parent URL's search component on the next read. Preserves insertion order and allows repeated keys (use append to add duplicates, set to collapse them).

URLSearchParams.append ​

ts
append(name: string, value: string): void

Append a name/value pair, even if name already exists.

URLSearchParams.delete ​

ts
delete(name: string): void

Remove every entry whose name equals name.

URLSearchParams.entries ​

ts
entries(): Array<Array<string>>

Return all entries as an array of [name, value] pairs in insertion order.

URLSearchParams.get ​

ts
get(name: string): string | null

Return the first value associated with name, or null if name is not present.

URLSearchParams.has ​

ts
has(name: string): boolean

True when at least one entry has the given name.

URLSearchParams.keys ​

ts
keys(): Array<string>

Return every entry name in insertion order.

URLSearchParams.set ​

ts
set(name: string, value: string): void

Replace every existing entry for name with a single entry (name, value). The first occurrence is updated in place; subsequent duplicates are dropped. Appends a fresh entry if name is not present.

URLSearchParams.toString ​

ts
toString(): string

Render as a percent-encoded query string (without the leading ?). Returns the empty string when no entries are present.

URLSearchParams.values ​

ts
values(): Array<string>

Return every entry value in insertion order.

URL class ​

ts
class URL

Parsed URL with mutable components. Constructing throws TypeError if input cannot be parsed. Writes to individual components rebuild the dependent fields (e.g. assigning to protocol updates href and origin). The searchParams accessor returns a live URLSearchParams bound to this URL's query string.

URL.hash ​

ts
hash: string

Fragment including the leading #, or empty when absent.

URL.host ​

ts
host: string

hostname plus :port when a non-default port is present.

URL.hostname ​

ts
hostname: string

Host without port.

URL.href ​

ts
href: string

Full URL, regenerated from the component fields.

URL.origin ​

ts
origin: string

protocol + // + host for hierarchical URLs. Read-only in spirit: assigning has no defined effect.

URL.pathname ​

ts
pathname: string

Path component including the leading /.

URL.port ​

ts
port: string

Port as a string. Empty when the protocol's default port applies.

URL.protocol ​

ts
protocol: string

Scheme including the trailing : (e.g. "https:").

ts
search: string

Query string including the leading ?, or empty when absent.

URL.searchParams ​

ts
searchParams: URLSearchParams

Live view of the query string as a URLSearchParams. Mutations propagate back into search and href.

new URL() ​

ts
constructor(input: string)

Parse input as a URL. Throws TypeError if parsing fails or input is not a string.

URL.toString ​

ts
toString(): string

Equivalent to reading href.

URL.decode ​

ts
static decode(value: string): string

Percent-decode a single value (the inverse of encode).

URL.encode ​

ts
static encode(value: string): string

Percent-encode a single value for use in a URL component.


Generated from lang/types/builtin_url.d.tks in the ThicketScript repository.