New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@koax/compose

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@koax/compose

Compose koax middleware.

latest
Source
npmnpm
Version
0.3.7
Version published
Maintainers
1
Created
Source

compose

Build status Git tag NPM version Code style

Compose koax middleware.

Installation

$ npm install @koax/compose

Usage

var compose = require('compose')

var composed = compose([function * (action, next) {
  if (action === 'foo') return 'bar'
  yield 'woot'
  return next()
}, function * (action, next) {
  if (action === 'bar') return 'qux'
  yield 'narf'
  return next()
}])

composed('foo')() // => 'bar' (done)
composed('bar')() // => 'woot', 'qux' (done)
composed('dup')() // => 'woot', 'narf', 'dup' (done)

API

compose(middleware)

  • middleware - compose the given middleware

Returns: a generator of the same form as the middleware

middleware

/**
 * The middleware signature
 * @param {Mixed} action   an immutable action that middleware can process
 * @param {Function} next  pass execution to next middleware (can yield or return)
 * @param {Object} ctx     the global context
 * @return {Mixed}         whatever your heart desires
 */

function * middleware (action, next, ctx) {

}

License

MIT

FAQs

Package last updated on 24 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts