Socket
Socket
Sign inDemoInstall

koa-route

Package Overview
Dependencies
5
Maintainers
10
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.1.0

5

History.md
3.0.0 / 2015-11-17
===================
* update to promise-based middleware
2.4.2 / 2015-07-02

@@ -3,0 +8,0 @@ ===================

34

index.js

@@ -26,18 +26,26 @@

return function (ctx, next){
// method
if (!matches(ctx, method)) return next();
const createRoute = function(routeFunc){
return function (ctx, next){
// method
if (!matches(ctx, method)) return next();
// path
const m = re.exec(ctx.path);
if (m) {
const args = m.slice(1).map(decode);
debug('%s %s matches %s %j', ctx.method, path, ctx.path, args);
args.unshift(ctx);
args.push(next);
return Promise.resolve(fn.apply(ctx, args));
// path
const m = re.exec(ctx.path);
if (m) {
const args = m.slice(1).map(decode);
debug('%s %s matches %s %j', ctx.method, path, ctx.path, args);
args.unshift(ctx);
args.push(next);
return Promise.resolve(routeFunc.apply(ctx, args));
}
// miss
return next();
}
};
// miss
return next();
if (fn) {
return createRoute(fn);
} else {
return createRoute;
}

@@ -44,0 +52,0 @@ }

@@ -5,3 +5,3 @@ {

"repository": "koajs/route",
"version": "3.0.0",
"version": "3.1.0",
"keywords": [

@@ -8,0 +8,0 @@ "koa",

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