deepFreeze()
function deepFreeze<T>(value): T & DepSafe
Deep-freeze an object, making it dependency-safe.
This function is similar to Object.freeze() but freezes the object and deep-freezes all its properties, recursively. The object is then not only immutable but also constant. Note that as a result all objects reachable from the parameter will be frozen and no longer mutable or extensible, even from other references.
The argument object and all its properties, recursively, must not already be frozen by Object.freeze
(or else deepFreeze
cannot mark them deep-frozen).
Undefined, function (and hence class) values cannot be deep-frozen.
The primary use for this function is to satisfy the requirement that all parameters to Skip Mapper
or Reducer
constructors must be dependency-safe: objects that have not been constructed by Skip can be passed to deepFreeze()
before passing them to a Mapper
or Reducer
constructor.
Type Parameters
Type Parameter | Description |
---|---|
T | Type of value to deep-freeze. |
Parameters
Parameter | Type | Description |
---|---|---|
value | T | The object to deep-freeze. |
Returns
T
& DepSafe
The same object that was passed in.