1.0.0 • Published 9 years ago

cstore v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

cstore

NPM version License Build status

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.

License

MIT

1.0.0

9 years ago