Skip to main content

Module builtins

Module builtins 

Source
Expand description

The standard library: the globals a script reaches without an import.

The set installed here is the one milestone M4 targets — Object, Function, Array, String, Number, Boolean, Math, JSON and the error classes — which is what a script needs before it can do anything useful at all.

Two conventions run through every module:

  • A method is a native function stored on a prototype, and it receives this exactly as a script method would. Nothing is special-cased by call site.
  • Argument checks throw the same error class the reference does, because the test suite asserts on instanceof and on e.name.

Modules§

bigint
The BigInt constructor and its prototype.
disposable
DisposableStack and AsyncDisposableStack.
iterator
Iterator and its helpers (ES2025 §27.1.4 plus the sequencing additions).
map
Map and Set.
promise
Promise, its prototype, and the combinator statics.
proxy
The Proxy constructor and Proxy.revocable.
regexp
RegExp and RegExp.prototype.
typedarray
ArrayBuffer and the typed-array views.
weak
WeakMap, WeakSet, WeakRef and FinalizationRegistry.

Functions§

arg
Argument index, or undefined when it was not passed.
arg_int_or
Argument index as an integer, or None when it is undefined — the shape optional numeric arguments need.
arg_number
Argument index as a number, with the undefined-is-NaN rule of ToNumber.
define_method
Define name on target as a non-enumerable method, the way every built-in method is defined.
has_arg
Whether argument index was actually passed.
install
Install the standard library on interp’s realm.
install_tag
Give object a Symbol.toStringTag data property answering tag.
method
A native function object, ready to be stored as a value.
this_object
The this of a method call, as an object.
this_string
The text a string method operates on, whether this is a primitive or a box.