Skip to main content

Module inspect

Module inspect 

Source
Expand description

util.inspect / util.format: the one value renderer this runtime has.

Node renders values the same way in three places — console.log, util.inspect and util.format’s %o / %O / %j specifiers — so there is one implementation here, used by the runtime’s console global and by the util module next door.

Written here, not vendored from llrt (upstream’s util has no inspect at all and its console formatter is not reusable).

Structs§

Inspector
Renders JS values the way util.inspect does, with or without colour.

Constants§

MAX_ARRAY_LENGTH
Node’s maxArrayLength: elements past this are summarised as ... N more items rather than printed.
MAX_DEPTH
Nesting depth at which containers render as [Array] / [Object], matching util.inspect’s depth: 2 default.
MAX_DIR_DEPTH
Ceiling for an explicit console.dir(value, { depth: null }), which is otherwise unbounded and would happily walk a cyclic-free but enormous object graph.

Functions§

strip_ansi
Strip ANSI escape sequences from a string.