Skip to main content

Module util

Module util 

Source
Expand description

Node util module: format, inspect, and a subset of util.types.

Constants§

METHODS
MIME_PARAMS_METHODS
Method names dispatched through mime_params_instance_call (for instance_has_method wiring; @@iterator powers for..of / spread).
MIME_TYPE_METHODS
Method names dispatched through mime_type_instance_call.

Functions§

call
constant
Non-function util exports (require('util').TextEncoder, .MIMEType, …). Each resolves to a Builtin("<name>") the parent constructs via new.
construct_mime_params
new util.MIMEParams() — an empty parameter set (Node’s constructor takes no arguments).
construct_mime_type
new util.MIMEType(input) — parse into type/subtype/essence/params.
format
util.format(fmt, ...args) — printf-style substitution (%s %d %i %f %j %o %O %c %%) with any leftover arguments appended space-separated. Fallible because three of the directives can throw and node lets those throws out: %j on a BigInt is TypeError: Do not know how to serialize a BigInt, and %d/%i/%f on a value whose coercion reaches a Symbol is TypeError: Cannot convert a Symbol value to a string. Returning a bare String meant each of those printed undefined or NaN instead.
mime_params_instance_call
MIMEParams instance methods.
mime_type_instance_call
MIMEType instance methods. type/subtype/essence/params are data properties read directly; toString/toJSON serialize live (reflecting any params mutation).