# compose-simple-middleware

> Middleware composition utility

Latest version **0.1.1** (published 2016-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install compose-simple-middleware
pnpm add compose-simple-middleware
yarn add compose-simple-middleware
bun add compose-simple-middleware
```

## 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.1.1 |
| Published | 2016-05-30 |
| First published | 2016-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Peeyush Kushwaha |
| Maintainers | peey |
| Keywords | middleware |

## Links

- npm: https://www.npmjs.com/package/compose-simple-middleware
- Repository: https://github.com/peey/compose-simple-middleware
- Issues: https://github.com/peey/compose-simple-middleware/issues
- npm.io page: https://npm.io/package/compose-simple-middleware

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2016-05-30
- 0.1.0 — 2016-05-30

## README

# compose-simple-middleware

A utility module implementing the middleware design pattern.

## Installation

If you want to use this in browser, simply download the src/compose-simple-middleware.js file and include it via
a script tag. The module exposes a global variable called `composeMiddleware`.

If you want to use this in node.js, simply install via npm using `npm install compose-simple-middleware` and in
your code use it by `var composeMiddleware = require("compose-simple-middleware")`

## Usage

Pass an array of middleware functions of signature `function (context, next)` to get a composed function that accepts
a context object and returns the value of operations performed.

When the returned function is called, the first function in the middleware array is invoked with the context. 
`next()` can be thought of as a reference to the next function in the middleware array, except that you don't
have to pass arguments to it and this module takes care of passing `context, next` to the next function in
the middleware list.

## Examples

See `test/test.js` for simple and illustrative examples on how to use this module. Don't be overwhelmed by the 
directory being named `test`. They are just examples, specified in a way that we could make sure that they work
correctly by running them and testing their outputs.

If you want a tutorial on how you can use the middleware pattern in your code, stay tuned.

## License

MIT License. See LICENSE file.

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