Socket
Socket
Sign inDemoInstall

middleware-flow

Package Overview
Dependencies
19
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.3.0

lib/or.js

17

index.js

@@ -110,2 +110,7 @@ var createCount = require('callback-count');

else {
// TODO
// if (err && conditional.then[0] && conditional.then[0].length === 4) {
// console.log('fjdksl;afjksdla;fsda');
// conditional.then[0] = conditional.then[0].bind(null, err);
// }
flow.series.apply(null, conditional.then)(req, res, next);

@@ -121,15 +126,15 @@ }

};
return thenAndElse(this._execConditional(conditional), conditional);
return thenAndElse(flow._execConditional(conditional), conditional);
},
mwIf: function (mw) {
return this.conditional('middleware', mw);
return flow.conditional('middleware', mw);
},
syncIf: function (mw) {
return this.conditional('sync', mw);
return flow.conditional('sync', mw);
},
asyncIf: function (mw) {
return this.conditional('async', mw);
return flow.conditional('async', mw);
},
if: function (val) {
return this.conditional('value', val);
return flow.conditional('value', val);
}

@@ -159,2 +164,2 @@ };

};
}
}
{
"name": "middleware-flow",
"version": "0.2.1",
"version": "0.3.0",
"description": "Middleware control flow library: series, parallel, or, and",

@@ -10,3 +10,4 @@ "main": "index.js",

"scripts": {
"test": "mocha test"
"test": "lab -l test",
"test-watch": "nodemon --exec lab -l test"
},

@@ -24,10 +25,10 @@ "repository": {

"dependencies": {
"101": "^0.3.0",
"callback-count": "0.0.3"
},
"devDependencies": {
"should": "^3.1.3",
"mocha": "^1.17.1",
"supertest": "^0.9.0",
"express": "^3.5.0"
"express": "~3.5.0",
"lab": "^3.1.1"
}
}

@@ -6,21 +6,7 @@ var express = require('express');

var middlewares = Array.prototype.slice.call(arguments);
console.log(middlewares.length);
var app = express();
app.use(express.json());
app.use(express.urlencoded());
app.use(mw.series.apply(mw, middlewares));
app.use(app.router);
// app.use(express.errorHandler());
app.use(errorHandler);
app.all('/', sendBody);
middlewares.forEach(function (mw) {
app.use(mw);
});
return app;
};
function errorHandler (err, req, res, next) {
res.json(500, {
message: err.message
});
}
function sendBody (req, res, next) {
res.json(req.body);
}
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