Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function deepFreeze(obj) {
if(isObject(obj) && !Object.isFrozen(obj)) {
Object.keys(obj).forEach(name => deepFreeze(obj[name]));
Object.freeze(obj);
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment