MCPcopy Create free account
hub / github.com/activejs/activejs / deepFreeze

Function deepFreeze

packages/core/src/utils/funcs.ts:130–146  ·  view source on GitHub ↗
(o: T)

Source from the content-addressed store, hash-verified

128 * @internal please do not use.
129 */
130export function deepFreeze<T>(o: T): T {
131 if (!isObject(o)) {
132 return o;
133 }
134
135 if (Array.isArray(o)) {
136 (o as any).forEach(v => deepFreeze(v));
137 } else if (isDict(o)) {
138 Object.keys(o).forEach(k => deepFreeze(o[k]));
139 }
140
141 try {
142 return Object.freeze(o);
143 } catch (e) {
144 return o;
145 }
146}
147
148/**
149 * @internal please do not use.

Callers 3

updateValueAndCacheFunction · 0.90
dispatchMethod · 0.90
extras.spec.tsFile · 0.90

Calls 2

isObjectFunction · 0.85
isDictFunction · 0.85

Tested by

no test coverage detected