observable stateful key value object store
const store = require('key-value-store-state').store;
// es6
import { store } from 'key-value-store-state';
// create a Store instance with an initial state
const myStore = store({foo: 'bar'});
console.log(myStore.get('foo'));
//=> 'bar'
myStore.set('awesome', true);
console.log(myStore.get('awesome'));
//=> true
// Use dot-notation to access nested properties
myStore.set('bar.baz', true);
console.log(myStore.get('bar'));
//=> {baz: true}
myStore.delete('awesome');
console.log(myStore.get('awesome'));
//=> undefined
Returns a new instance.
Type: Object
You can use dot-notation in a key
to access nested properties.
Set an item.
Set multiple items at once.
Get an item.
Check if an item exists.
Delete an item.
Get the item count.
Subscribe to changes on an object. You can use dot-notation here also
Create a clone of the store instance
Create a clone of the state
Get the current state.
Get the last state.
Get the sored data as JSON.
MIT