hold-it

A simple singleton container

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
hold-it
001.0.16 years ago6 years agoMinified + gzip package size for hold-it in KB

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
  • key string name of the key
  • value any anything

  • Throws TypeError when property is already present
get
Get value at key property
Parameters
  • key string property to get
  • silent boolean? whether to throw error if property not defined (optional, default false)

  • 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 key
  • value any anything
unpack
Unpack, just expose the data object, so that we can use desctructing
Returns Object the whole data