throwback
- Version 4.1.0
- Published
- 26.9 kB
- No dependencies
- MIT license
Install
npm i throwback
yarn add throwback
pnpm add throwback
Overview
Simple asynchronous middleware pattern
Index
Variables
variable compose
const compose: <T, U>(middleware: Middleware<T, U>[]) => Composed<T, U>;
Compose an array of middleware functions into a single function.
Functions
function composeMiddleware
composeMiddleware: <T, U>(middleware: Array<Middleware<T, U>>) => Composed<T, U>;
Production-mode middleware composition (no errors thrown).
Type Aliases
type Composed
type Composed<T, U> = (ctx: T, done: Done<T, U>) => Promise<U>;
Composed function signature.
type Done
type Done<T, U> = (ctx: T) => U | Promise<U>;
Final function has no
next()
.
type Middleware
type Middleware<T, U> = (ctx: T, next: Next<U>) => U | Promise<U>;
Middleware function pattern.
type Next
type Next<T> = () => Promise<T>;
Next function supports optional
ctx
replacement for following middleware.
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (13)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/throwback
.
- Markdown[](https://www.jsdocs.io/package/throwback)
- HTML<a href="https://www.jsdocs.io/package/throwback"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1970 ms. - Missing or incorrect documentation? Open an issue for this package.