deepCloneAndFreeze
deepCloneAndFreeze<
T>(value,seen?):T
Defined in: packages/ddd-core/domain/events/root-domain.event.ts:63
Deep clones and recursively freezes any value, object, array, Date, Set, Map, or RegExp. Safely handles circular references via a WeakMap tracking visited objects. Guarantees that mutations on original nested objects do not leak into the clone.
Object.freeze covers own properties only. The internal state of a cloned
Date, Map or Set is guarded by overriding its mutating methods, which stops
ordinary calls such as date.setTime(...) but not
Date.prototype.setTime.call(date, ...). Treat the result as detached and
ordinarily read-only, not as a security boundary.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”T
WeakMap<object, unknown> = ...
Returns
Section titled “Returns”T