a lightweight library for projects that allow you to work with local and session storage.
npm install simple-storage-tools --save
yarn add simple-storage-tools
bower install simple-storage-tools --save
first, you must import it.
var Storage = require('simple-storage-tools').Storage;
import { Storage } from 'simple-storage-tools';
then you can use it like this:
let json = {
value1: 'Hello',
value2: 'World'
}
// it will store `json` as an session storage
Storage.set('some-storage', json);
// it will store `json` as an local storage
Storage.set('some-storage', json, true);
// it will get storage from sessionStorage Object
let r = Storage.get('some-storage');
// it will get storage from localStorage Object
// let r = Storage.get('some-storage', true);
console.log(r.value1 + ' ' + r.value2); // print Hello World in console
you can see more examples here
npm run test
feel free to fork and do what ever you want (or send pull requests).
for contribute this project, first clone the project and go to project folder:
git clone https://github.com/MetaiR/simple-storage-tools.git
cd simple-storage-tools
then run:
npm install
after that you ready to go :D