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
URLexposes as writable ACCESSORS on its prototype. - MODULE_
METHODS - SEARCH_
PARAMS_ METHODS - Method names dispatched through
search_params_call(forinstance_has_methodwiring instdlib::mod;@@iteratormakes[...params]/for..ofwork). - STATIC_
METHODS - Statics on the
URLCLASS — distinct fromMODULE_METHODS, which are the legacyrequire('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, anotherURLSearchParams, or empty.- instance_
call URLinstance methods (component reads are plain data properties).- is_
component - Whether
nameis aURLcomponent whose assignment must refresh the derived fields. - search_
params_ call URLSearchParamsinstance methods.- set_
component - Assign one
URLcomponent through the URL Standard’s setter for it — the state-override parseurl::quirksimplements — 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; onlyhrefthrows, since it reparses the whole URL. - static_
call URL.canParse(input[, base])/URL.parse(input[, base]).