Re:Overview of JavaScript ES6 features
by Roboprog on Monday October 24, 2016 @12:28PM
(#12780307)
Any popular "deep freeze" utilities around?
[ Parent
| on HN ]
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;
}