0.5.0 • Published 8 years ago
protect v0.5.0
protect
protect your object from being overridden
Installation
Install through NPM
npm install protector
git clone git://github.com/hex7c0/protect.gitAPI
inside nodejs project
var protect = require('protect');
var newObj = protect({
foo: 'ciao'
});
newObj.ciao = 'ciao';
newObj.foo = 123;with this exception
a.foo = 123;
^
TypeError: Cannot assign to read only property 'foo' of [object Object]protect(obj, normal)
options
obj- Object Your object (default "required")normal- Boolean Using{}constructor (default "Object.create(null)")
Examples
Take a look at my examples