Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.
/ store Public archive

local store, unserializes and serializes values automagically :)

Notifications You must be signed in to change notification settings

yields/store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

store

minimal store inspired by component/cookie

Installation

$ 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)

set key to val, the value will be JSON.stringify()ied.

store(obj)

store the given object.

store(key, null)

remove key.

store(key)

get key value, it will be unserialized.

store(null)

invokes localStorage.clear()

store()

get all items, they will be unserialized.

License

MIT

About

local store, unserializes and serializes values automagically :)

Resources

Stars

Watchers

Forks

Packages

No packages published