Skip to content

Instantly share code, notes, and snippets.

@negue
Created July 7, 2020 20:15
Show Gist options
  • Save negue/6af9fcd38d4b04dc9a3565c4c19ce819 to your computer and use it in GitHub Desktop.
Save negue/6af9fcd38d4b04dc9a3565c4c19ce819 to your computer and use it in GitHub Desktop.
function deepFreeze (o) {
Object.freeze(o);
Object.getOwnPropertyNames(o).forEach(function (prop) {
if (o.hasOwnProperty(prop)
&& o[prop] !== null
&& (typeof o[prop] === "object" || typeof o[prop] === "function")
&& !Object.isFrozen(o[prop])) {
deepFreeze(o[prop]);
}
});
return o;
};
TuningReturner = deepFreze(....)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment