middleware-flow
Advanced tools
Comparing version 0.2.1 to 0.3.0
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); | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24104
3
15
789
2
1
+ Added101@^0.3.0
+ Added101@0.3.41.6.3(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedassertion-error@1.0.0(transitive)
+ Addedasync@0.2.100.8.0(transitive)
+ Addedchai@1.10.0(transitive)
+ Addedclone@1.0.4(transitive)
+ Addeddeep-eql@0.1.3(transitive)
+ Addeddiff@1.4.0(transitive)
+ Addedesprima@1.2.5(transitive)
+ Addedhandlebars@1.3.0(transitive)
+ Addedkeypather@1.10.2(transitive)
+ Addedlab@3.1.4(transitive)
+ Addedminimist@0.0.10(transitive)
+ Addedoptimist@0.3.70.6.1(transitive)
+ Addedsource-map@0.1.43(transitive)
+ Addedtype-detect@0.1.1(transitive)
+ Addeduglify-js@2.3.6(transitive)
+ Addedwordwrap@0.0.3(transitive)