Skip to main content

Module util_types

Module util_types 

Source
Expand description

Node util.types — runtime type-tag predicates.

Every function here answers “what internal kind is this value?” without any user-observable coercion, mirroring Node’s require('node:util/types'). Each predicate inspects the argument’s JsObj heap variant or its hidden @@native tag and returns a plain boolean, so classification reuses the exact machinery the rest of the runtime already relies on:

  • Map/Set carry a weak flag → the weak/non-weak split;
  • RegExp/Promise/Generator are first-class heap variants;
  • Date/ArrayBuffer/TypedArray/Buffer are plain objects wearing a @@native tag (see date.rs/typedarray.rs/buffer.rs);
  • async/generator functions are read off the shared FuncDef flags;
  • isNativeError defers to the real host::instance_of against Error.

Deviations from V8, kept honest (node-js is not V8):

  • isProxy is always false — there is no Proxy in node-js.
  • No boxed primitives exist (Number(x) yields a primitive, never an object wrapper), so isBoxedPrimitive and the is{Number,String,…}Object family are all false.
  • isArgumentsObject is false: arguments is materialised as a plain array (see host.rs), indistinguishable from any other array here.
  • No SharedArrayBuffer/DataView/BigInt64Array, module-namespace, or external objects → those predicates are false.

Constants§

METHODS

Functions§

call