cstore
v1.0.0
Published
Super tiny, closure-based data store.
Downloads
5
Readme
cstore
Super tiny, closure-based data store.
Installation
npm install cstore
Usage
const cstore = require('cstore')
const store = cstore()
store.add('foo') // => "foo"
store.add('bar') // => "bar"
store.add('baz') // => "baz"
store() // => ["foo", "bar", "baz"]
store(0) // => "foo"
store(1) // => "bar"
store(2) // => "baz"
store.remove(2) // => "baz"
store.remove(1) // => "bar"
store() // => ["foo"]
API
store = cstore()
Initialize a store.
store.add(value)
Add the given value.
store.remove(key)
Remove a value by passing the given key.
store([key])
Get a value by passing the given key or all values by passing nothing. Aliased
to store.get
.