Simple implementation of local storage with indexedDB
npm install indexed-storage
yarn add indexed-storage
Documentation
The main store function:
; // sets data under key; // returns data stored under key; // sets all key/data pairs in the object; // returns all stored key/data pairs as an object; // clears all items from storage
There are also more explicit and versatile functions available:
store; // === store(key, data);store; // === store({key: data, key2: data});store; // === store(key);store; // === store();storeclear; // === store(false);store; // returns true or falsestore; // removes key and its data, then returns the datastore; // concats, merges, or adds new value into existing onestoresize; // number of keys, not length of datastore; // clears *ALL* areas (but still namespace sensitive)
All functions are async 🚀 and return Promise
Examples
// set value // "foo" // get value // {foo: "bar"} // existence of keystore // true //store key/value data from object // "key2" //get all key/value pairs as object // {foo: {bar: "baz"}, key1: "data1", key2: "data2"} //clear all data // undefined