network.http-router
Advanced tools
Comparing version 0.0.1 to 0.0.2
25
index.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
module.exports = function makeRouter(route, handler, parent) { | ||
module.exports = exports = function makeRouter(route, handler, parent) { | ||
var router = function routeHandler(oreq, ores, onext) { | ||
@@ -79,6 +79,27 @@ if (!onext) { | ||
return makeRouter(route, fn, this); | ||
return makeRouter(route, fn, router); | ||
}; | ||
router.useAll = function(routes) { | ||
return reduce(function(router, route) { | ||
if (typeof route === 'function') { | ||
return router.use(route); | ||
} else { | ||
return router.use(route[0], route[1]); | ||
} | ||
}, router, routes); | ||
}; | ||
return router; | ||
}; | ||
function reduce(fn, data, array) { | ||
var index = -1; | ||
var length = array.length; | ||
while (index++ < length) { | ||
data = fn(data, array[index]); | ||
} | ||
return data; | ||
} |
{ | ||
"name": "network.http-router", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"repository": { | ||
@@ -16,4 +16,7 @@ "type": "git", | ||
"bugs": { | ||
"url": "https://github.com/L8D/network.http-router" | ||
"url": "https://github.com/L8D/network.http-router/issues" | ||
}, | ||
"dependencies": { | ||
"data.future": "^2.3.0" | ||
} | ||
} |
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 bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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 README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
5996
7
122
1
35
1
+ Addeddata.future@^2.3.0
+ Addeddata.future@2.3.0(transitive)