State at the type level what the operations below enforce at run time: a structure no caller may write to, or one
stated slot by slot without loosening the type of any slot:
immutable(fn) === fn; // true (handed back unchanged, properties still mutable) immutable(newDate()); // the same Date, not a frozen clone
Stable Identity
Cloning is idempotent at every depth: each frozen object and array is branded, so re-freezing a clone, or any nested
member extracted from it, returns the same reference rather than a fresh copy. A frozen member keeps its identity
even when reached through another path or nested into a new structure:
General-purpose value operations.
Deep Views
State at the type level what the operations below enforce at run time: a structure no caller may write to, or one stated slot by slot without loosening the type of any slot:
Deep Equality
Compare nested structures for structural equality:
Deep Freezing
Create deeply frozen clones of plain objects and arrays, leaving every other value untouched:
Stable Identity
Cloning is idempotent at every depth: each frozen object and array is branded, so re-freezing a clone, or any nested member extracted from it, returns the same reference rather than a fresh copy. A frozen member keeps its identity even when reached through another path or nested into a new structure:
Type-Safe Freezing
Validate and freeze with optional type guards:
Sealed Content
Attach hidden content to a frozen clone under a symbol key, retrievable only through the same symbol:
Both the sealed clone and its content are deep-frozen and branded, so immutable returns them unchanged: