simple-webstorage

A clean interface for localStorage / sessionStorage in <20 lines of code.


Keywords
webstorage, localstorage, sessionstorage, simple, small, storage
License
MIT
Install
bower install simple-webstorage

Documentation

simpleWebstorage

A clean interface for localStorage / sessionStorage in <20 lines of code.

Even simpler than simpleStorage the simpler fork of jStorage.

Installs with bower install simple-webstorage --save

Usage

localStorage.set('myKey',{a:[1,2,5], b: 'ok'}); //can set a json Object
localStorage.assign('myKey',{a:[6], c:42});     //shallow merge using Object.assign
localStorage.has('myKey');                      // --> true
localStorage.get('myKey');                      // --> {a:[6], b: 'ok', c:42}
localStorage.keys();                            // --> ['myKey']
localStorage.remove('myKey');                   // -

of course you can use native

localStorage.clear();
localStorage.length;

works as well with sessionStorage.