function deepFreeze(obj) { const out = Object.freeze(obj); Object.keys(out).forEach(key => { if (typeof out[key] === 'object') { out[key] = Object.freeze(out[key]); } }); return out; }
(recursive)