combo-storage
v2.1.2
Published
The package allows you to manage data in LocalStorage, SessionStorage and Cookies
Downloads
2,362
Maintainers
Readme
Table of contents
Installation
You need to install package.
npm install combo-storage
Getting started
You should import the required storage to use the package
import { LocalStorage, SeessionStorage, Cookie } from 'combo-storage'
Then use the methods of storage. For example:
LocalStorage.set('user', 'awibox');
Base methods for LocalStorage and SessionStorage
|Method|LocalStorage|SessionStorage
|------|------------|--------------|
|set|LocalStorage.set(key, value)
|SessionStorage.set(key, value)
|
|get|LocalStorage.get(key)
|SessionStorage.get(key)
|
|remove|LocalStorage.remove(key)
|SessionStorage.remove(key)
|
|сlear|LocalStorage.clear()
|SessionStorage.clear()
|
Note: get and set methods are available for working with objects and arrays.
Cookie methods
|Method|Example|
|------|------------|
|set|Cookie.set(name, value, days);
|
|get|Cookie.get(name)
|
|remove|Cookie.remove(name)
|
Contributing
Please read through our CONTRIBUTING.md.