Storage

Storage

new Storage(type, silentopt)

Parameters:
Name Type Attributes Default Description
type string The store backend to use
silent boolean <optional>
true Whether to throw exceptions or fail silently returning false
Source:

Methods

get(key, defaultValue) → {string}

Gets the stored value for a specified key
Parameters:
Name Type Description
key string The key to look up
defaultValue Return this if no value has been found
Source:
Throws:
If not silent
Type
Error
Returns:
The stored value or defaultValue
Type
string

has(key) → {boolean}

Checks whether the store knows about the specified key
Parameters:
Name Type Description
key string The key to check for existance
Source:
Throws:
If not silent
Type
Error
Returns:
If silent, returns false on error (!!)
Type
boolean

remove(key) → {Storage|boolean}

Deletes the specified key and its value from the store
Parameters:
Name Type Description
key string The key to delete
Source:
Returns:
If silent, returns false on error
Type
Storage | boolean

set(key, value, optionsopt) → {Storage|boolean}

Writes a value to the store under the specified key
Parameters:
Name Type Attributes Description
key string The key to use when storing
value string The value to store
options object <optional>
A map of options. See the respective backends.
Source:
Throws:
If not silent
Type
Error
Returns:
If silent, returns false on error. Returns this on success.
Type
Storage | boolean