cstore

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i cstore

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • gummesson