0.1.0 • Published 3 years ago

composed-store v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

composed-store

Composed store inspired by koa-compose

NPM version NPM download

Install

$ npm i composed-store -S

Usage

const { createStore } = require('composed-store');

// create store instance and compose with sub stores. 
const store = createStore();
store.add(new Store_Impl1());
store.add(new Store_Impl2());
store.add(new Store_Impl3());

// get
const value = await store.get({ query: { key: 'foo' }});

// set
await store.set('a', 'b');

Notice: the first arg in .get() is wrapped as Koa-Context-Like object