0.0.0 • Published 9 years ago

type-lock v0.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Type Lock

Locks an objects properties to a specific type

Build Status

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 );