The count of distinct interned names.
Return the id for name without interning, or undefined when the
name has never been interned. This is the hot-path probe for
user-supplied names.
The string to look up.
Return the id for name, assigning the next dense id if the name has
not been seen before.
The string to intern.
The (possibly newly assigned) integer id.
Return the name for id, or undefined for an id never assigned.
The integer id to invert.
Generated using TypeDoc
A string↔integer bimap. Assigns dense ids (0, 1, 2, …) in first-seen order; lookups are O(1) both directions. Grows monotonically — there is no removal, matching machine semantics (states and actions are fixed after construction; late interning only happens for never-matching lookups such as hook registrations naming unknown states).
const i = new Interner(); i.intern('red'); // 0 i.intern('green'); // 1 i.intern('red'); // 0 (idempotent) i.id_of('green'); // 1 i.name_of(0); // 'red'
pair_key