composed-store
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i composed-store

Weekly Downloads

5

Version

0.1.0

License

none

Unpacked Size

9.07 kB

Total Files

13

Last publish

Collaborators

  • luckydrq