store
minimal store inspired by component/cookieInstallation
$ component install yields/store
Example
store('foo', ['baz']);
store('foo'); // > ['baz']
store({ foo: 'baz' });
store('foo'); // > 'baz'
store('foo', null);
store('foo'); // > null
store('baz', 0);
store(); // > { baz: 0 }
store(null);
store(); // > {}
API
store(key, val)
setkey
to val
, the value will be JSON.stringify()
ied.store(obj)
store the givenobject
.store(key, null)
removekey
.store(key)
getkey
value, it will be unserialized.store(null)
invokeslocalStorage.clear()