deep-lockdown

0.0.3 • Public • Published

Deep Lockdown


Recursively call Object.freeze(), Object.seal(), and Object.preventExtensions() on objects.

This is based on the deep-freeze library but takes it a step further and prevents new properties from being added or removed to the object. It also marks all existing properties as non-configurable.


Install

npm install deep-lockdown


Usage

var deepLockdown = require('deep-lockdown');
 
var myObj = {
  a: 'a',
  b: 'b',
  c: {
    e: {
      q: 'word'
    }
  }
};
 
deepLockdown(myObj);
 
myObj.d = 'd';
myObj.a = 'jkl';
myObj.c.e.q = 'different-word';
myObj.c.e.f = 'add-some-words';
 
console.log(myObj);

var myObj = { a: 'a', b: 'b', c: { e: { q: 'word' } } };

Package Sidebar

Install

npm i deep-lockdown

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • blaketarter
  • maxehnert