Freezer.js
object.freeze()
for all nested properties
Object.freeze doesn't freeze nested objects.
freeze.js is a lib written in typescript 2.0 which provides functions for deeply Freezing JS objects.
Usage
/* Assuming strict mode.If strict mode is not active the lines that throw errors will fail silently in some envs*/ // with normal Object.freeze obj.nested = 'new-value' // this worksobj.nested.a = 5 // this works //but we want a deep freeze so use freezerjs:freezer.freezeobjobj.nested = 'new-value' // throws errorobj.nested.a = 8 // throws error /*There is also a pureFreeze method. It freezes after cloning and accepts cloning method as arg*/ originalObj = 'new-value' // still worksoriginalObj.a = '5' // still works newObj = 'new-value' // throws errornewObj.a = '5' // throws error