Skip to content

cojs/composition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Composition

Create compositions of middleware just like koa-compose. However, this is for general usage, not specifically for koa. In particular:

  • No debug instrumentation
  • Returns the value of the first middleware.

Use this to create your own middleware platforms.

Example

var compose = require('composition')

co(function* () {
  var fns = []
  fns.push(function* (next) {
    return yield* next
  })
  fns.push(function* () {
    return this
  })

  var fn = compose(fns)

  var res = yield* fn.call(true)
  // => true
  // because of `return this`
})

About

create compositions of generator functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published