Comparing version 2.0.0-pre6 to 2.1.0
@@ -6,2 +6,3 @@ 'use strict'; | ||
var Debug = require('debug'); | ||
var Bluebird = require('bluebird'); | ||
@@ -75,1 +76,38 @@ var respond = require('quinn-respond'); | ||
} module.exports.runRequestHandler = runRequestHandler; | ||
function allValidHandlers(handlerArray) { | ||
if (handlerArray.length < 1) { | ||
return false; | ||
} | ||
return handlerArray.every(function(handler) { | ||
return typeof handler === 'function'; | ||
}); | ||
} | ||
function firstHandler() { | ||
var handlers = Array.prototype.slice.call(arguments); | ||
if (!allValidHandlers(handlers)) { | ||
var err = new Error('Usage: firstHandler(handler1, handler2, ...)'); | ||
return function() { | ||
return Bluebird.reject(err); | ||
}; | ||
} | ||
function _tryFirst(idx, req, params) { | ||
var handler = handlers[idx]; | ||
++idx; | ||
return Bluebird.try(handler, [req, params]) | ||
.then(function(res) { | ||
if (res === undefined && idx < handlers.length) { | ||
return _tryFirst(idx, req, params); | ||
} else { | ||
return res; | ||
} | ||
}); | ||
} | ||
return function(req, params) { | ||
return _tryFirst(0, req, params); | ||
}; | ||
} module.exports.firstHandler = firstHandler; |
{ | ||
"name": "quinn", | ||
"version": "2.0.0-pre6", | ||
"version": "2.1.0", | ||
"description": "Maybe coming some day.", | ||
@@ -26,6 +26,9 @@ "main": "dist/quinn.js", | ||
"devDependencies": { | ||
"envify": "^1.2.1", | ||
"jshint": "~2.5.1", | ||
"mocha": "^1.20.1", | ||
"quinn-render": "^1.0.0", | ||
"quinn-router": "^1.0.1", | ||
"quinnc": "^1.0.0", | ||
"react": "^0.10.0", | ||
"reakt": "0.0.5" | ||
@@ -32,0 +35,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
2
2
9457
8
9
181