Skip to content
This repository was archived by the owner on Nov 23, 2020. It is now read-only.

shimohq/compose

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bay-compose

Middleware composition utility for Bay.

NPM version

Like koa-compose@2, but:

  • returns the final value.
  • supports async function.
  • next is a yieldable function, e.g. yield * next equals yield * next().
npm i bay-compose
const 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)

About

Middleware composition utility

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%