minimal store inspired by component/cookie
$ component install yields/store
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(); // > {}
set key
to val
, the value will be JSON.stringify()
ied.
store the given object
.
remove key
.
get key
value, it will be unserialized.
invokes localStorage.clear()
get all items, they will be unserialized.
MIT