UNPKG

module-composer

Version:

Bring order to chaos. Level up your JS application architecture with Module Composer, a tiny but powerful module composition utility based on functional dependency injection.

16 lines (12 loc) 387 B
const freezeDeep = obj => { if (!obj || typeof obj !== 'object') return obj; if (Object.isFrozen(obj)) return obj; for (const key of Reflect.ownKeys(obj)) { const val = obj[key]; if (val && (typeof val === 'object' || typeof val === 'function')) { freezeDeep(val); } } return Object.freeze(obj); }; module.exports = freezeDeep;