bay-compose
v3.0.0
Published
Middleware composition utility for Bay.
Downloads
10
Readme
bay-compose
Middleware composition utility for Bay.
Like koa-compose@2, but:
- returns the final value.
- supports async function.
nextis a yieldable function, e.g.yield * nextequalsyield * next().
npm i bay-composeconst compose = require('bay-compose')
compose([
function * (next) {
yield next
},
function * (next) {
yield next()
},
function * (next) {
yield * next
},
function * (next) {
yield * next()
},
async function (next) {
await next()
},
function (next) {
next().then(doSomeJob)
}
])(context)