1.0.2 • Published 3 years ago

storage-helper-functions v1.0.2

Weekly downloads
29
License
MIT
Repository
github
Last release
3 years ago

StorageHelper

Kind: global class

new StorageHelper()

StorageHelper class

StorageHelper.module.exports

Kind: static class of StorageHelper

new module.exports(storageProvider, compressed)

Creates an instance of StorageHelper.

ParamTypeDefaultDescription
storageProviderlocalStorage | sessionStorageStorage provider, localStorage or sessionStorage
compressedbooleanfalseOption to use compression for strings

StorageHelper.store(key, data, format) ⇒ void

Stores data to storageProvider

Kind: static method of StorageHelper

ParamTypeDefaultDescription
keystringKey used to identify saved item
datastring | objectData to save
format'text' | 'json'"text"Data format

StorageHelper.get(key, format) ⇒ any

Gets key from storageProvider

Kind: static method of StorageHelper
Returns: any - - The value of said key

ParamTypeDefaultDescription
keystringKey to retrieve from storage
format'text' | 'json'"text"Format of stored data