hold-it
v1.0.1
Published
A simple singleton container
Downloads
460
Readme
A simple container
Install
npm install --save hold-it
Usage
Container
constructor
Parameters
data
Object intialize with this data
add
It won't rewrite if the key already exists, use update
Parameters
get
Get value at key property
Parameters
key
string property to getsilent
boolean? whether to throw error if property not defined (optional, defaultfalse
)Throws ReferenceError when the silent flag is false and the property is not found
Returns any whatever stored at the key property
set
Will not check if property already exist, will add or set it anyway
Parameters
key
string name of the keyvalue
any anything
unpack
Unpack, just expose the data object, so that we can use desctructing
Returns Object the whole data