deepFreeze es-toolkit
Recursively freezes an object, making it and all nested objects and arrays immutable.
Usage
deepFreeze(obj)
Use deepFreeze when you want to make an object completely immutable. Object.freeze only freezes the top-level properties of an object, so nested objects can still be modified. deepFreeze recursively freezes all nested objects and arrays, so nothing can be changed at any depth.
The object is frozen in place and the same reference is returned. Objects that are already frozen are skipped, so circular references are handled safely.
Parameters
The object to freeze deeply.
Returns
The same object, with itself and all nested objects and arrays frozen.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.