Created
July 7, 2020 20:15
-
-
Save negue/6af9fcd38d4b04dc9a3565c4c19ce819 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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