type-lock
v0.0.0
Published
Locks an objects properties to a specific type.
Downloads
7
Readme
Type Lock
Locks an objects properties to a specific type
Usage
var typeLock = require( 'type-lock' ),
obj = {
foo: 'bar',
baz: true
},
obj2 = typeLock( obj ) // returns new copy
typeLock( obj, true ) // locks exsisting object
obj.foo // 'bar' intial value
obj.foo = 'baz' // 'baz' returns back set value
obj.foo = true // throws cannot set property foo
obj.baz = 'bar' // throws cannot set property baz
// lock only one key
typeLock.lockKey( key, value, object );