poison-get
v1.0.0
Published
Throw when a user attempts to access specified properties in an object
Downloads
11
Readme
poison-get
Throw when a user attempts to access specified properties in an object
Install
$ npm install --save poison-get
Usage
var poison = require('poison-get')
var obj = poison({}, 'foo')
obj.foo
//=> throws Error
API
poison(obj, keys, [message])
-> object
obj
Required
Type: object
An object to modify with poison getters.
keys
Required
Type: string
/ array[string]
The key (or keys) where poison getters will be assigned.
message
Type: string
An error message to use when throwing
License
MIT © Ben Drucker