Socket
Socket
Sign inDemoInstall

middleware-flow

Package Overview
Dependencies
6
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.1 to 0.6.0

lib/each.js

1

index.js

@@ -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();

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc