middleware-flow
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -7,2 +7,3 @@ var createCount = require('callback-count'); | ||
flow.or = require('./lib/or'); | ||
flow.each = require('./lib/each'); | ||
flow.next = function (req, res, next) { | ||
@@ -9,0 +10,0 @@ next(); |
{ | ||
"name": "middleware-flow", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "Middleware control flow library: series, parallel, or, and", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -30,2 +30,23 @@ # middleware-flow [![Build Status](https://travis-ci.org/tjmehta/middleware-flow.png?branch=master)](https://travis-ci.org/tjmehta/middleware-flow) | ||
## each | ||
```js | ||
var each = require('middleware-flow').each; | ||
var arr = [1,2,3]; | ||
var app = require('express')(); | ||
// runs the middlewares in 'parallel' | ||
app.use( | ||
each(arr, | ||
// runs the middlewares in parallel | ||
function (eachReq, res, next) { | ||
// eachReq is a scoped req for the each function that reads from req, | ||
// but writes to it's own scope (prototypically inherits from request) | ||
}, | ||
function (item, req, eachReq, res, next) { | ||
// if middleware accepts five arguments, the current item and the original req are passed | ||
// eachReq is a scoped req for the each function that reads from req, | ||
// but writes to it's own scope (prototypically inherits from request) | ||
}) | ||
); // if err, returns the first error that occurred | ||
``` | ||
## or(middlewares...) | ||
@@ -32,0 +53,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1241
156
0
37865
24