Skip to main content

Module url

Module url 

Source
Expand description

Node url module: the WHATWG URL class (global + require('url').URL) and the legacy url.parse. Parsing and the component setters are the URL Standard’s, through the url crate (its basic URL parser and quirks setters). A URL instance keeps each component in a hidden @@<name> slot read by the accessors on URL.prototype; a setter rewrites every slot from the re-serialized URL (set_component), and the searchParams it carries holds an @@ownerUrl back-reference so its own mutations rewrite the query in the other direction.

Constants§

COMPONENTS
Parsed URL components. The component names a URL exposes as writable ACCESSORS on its prototype.
MODULE_METHODS
SEARCH_PARAMS_METHODS
Method names dispatched through search_params_call (for instance_has_method wiring in stdlib::mod; @@iterator makes [...params] / for..of work).
STATIC_METHODS
Statics on the URL CLASS — distinct from MODULE_METHODS, which are the legacy require('url') functions.

Functions§

call
construct
new URL(input[, base]).
construct_search_params
new URLSearchParams([init]) — from a query string, an object, an iterable of [key, value] pairs, another URLSearchParams, or empty.
instance_call
URL instance methods (component reads are plain data properties).
is_component
Whether name is a URL component whose assignment must refresh the derived fields.
search_params_call
URLSearchParams instance methods.
set_component
Assign one URL component through the URL Standard’s setter for it — the state-override parse url::quirks implements — and rewrite every stored field from the result. A value the setter rejects leaves the URL as it was (u.port = 'abc'), as in node; only href throws, since it reparses the whole URL.
static_call
URL.canParse(input[, base]) / URL.parse(input[, base]).