# @koax/compose

> Compose koax middleware.

Latest version **0.3.7** (published 2016-02-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @koax/compose
pnpm add @koax/compose
yarn add @koax/compose
bun add @koax/compose
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.7 |
| Published | 2016-02-24 |
| First published | 2016-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | koax |

## Links

- npm: https://www.npmjs.com/package/@koax/compose
- Repository: https://github.com/koaxjs/compose
- Homepage: https://github.com/koaxjs/compose#readme
- Issues: https://github.com/koaxjs/compose/issues
- npm.io page: https://npm.io/package/@koax/compose

## Dependencies (5)

- [@f/identity](https://npm.io/package/@f/identity.md) ^1.1.1
- [@f/flatten-gen](https://npm.io/package/@f/flatten-gen.md) ^1.2.3
- [@f/is-function](https://npm.io/package/@f/is-function.md) ^1.1.1
- [@f/is-iterator](https://npm.io/package/@f/is-iterator.md) ^1.0.1
- [@f/is-generator-object](https://npm.io/package/@f/is-generator-object.md) ^1.3.0

## Recent versions

- 0.3.7 (latest) — 2016-02-24
- 0.3.5 — 2016-02-24
- 0.3.4 — 2016-02-24
- 0.3.3 — 2016-02-24
- 0.3.2 — 2016-02-23
- 0.3.1 — 2016-02-03
- 0.3.0 — 2016-02-03
- 0.2.3 — 2016-02-03
- 0.2.2 — 2016-02-03
- 0.2.1 — 2016-02-03
- 0.2.0 — 2016-02-03
- 0.1.3 — 2016-02-02

## README

# compose

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Compose koax middleware.

## Installation

    $ npm install @koax/compose

## Usage

```js
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

```js
/**
 * 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

[travis-image]: https://img.shields.io/travis/koaxjs/compose.svg?style=flat-square
[travis-url]: https://travis-ci.org/koaxjs/compose
[git-image]: https://img.shields.io/github/tag/koaxjs/compose.svg
[git-url]: https://github.com/koaxjs/compose
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@koax/compose.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@koax/compose

---
_Source: https://npm.io/package/@koax/compose · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
