package
Compose generator and async/await middleware
npm install compositionGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Compose generator and async/await middleware like koa. Allows to use both generator functions and async/await functions.
var compose = require('composition');
var stack = [];
// generator functions
stack.push(function* (next) {
yield next;
});
// regular functions that return anything
// but they should be promises!
stack.push(function (next) {
return Promise.resolve(true);
});
// async/await functions
stack.push(async function (next) {
return await Promise.resolve(true);
});
jongleberry
jonathanrichardong@gmail.com