hypereact/state

View on GitHub
src/lib/utils/object.util.ts

Summary

Maintainability
A
45 mins
Test Coverage
B
87%
export function freeze(object: any) {
  if (object != null) {
    const propNames = Object.getOwnPropertyNames(object);
    for (const name of propNames) {
      const value = object[name];
      if (value && typeof value === "object") {
        freeze(value);
      }
    }
  }
  return Object.freeze(object);
}