Socket
Socket
Sign inDemoInstall

koa-router

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-router - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

7

lib/layer.js

@@ -168,6 +168,7 @@ var debug = require('debug')('koa-router');

var middleware = function *(next) {
if (fn.constructor.name === 'GeneratorFunction') {
yield *fn.call(this, this.params[param], next);
next = fn.call(this, this.params[param], next);
if (typeof next.next === 'function') {
yield *next;
} else {
yield Promise.resolve(fn.call(this, this.params[param], next));
yield Promise.resolve(next);
}

@@ -174,0 +175,0 @@ };

@@ -303,3 +303,3 @@ /**

var matched = router.match(path, this.method);
var layer;
var layer, i, ii;

@@ -313,4 +313,6 @@ if (this.matched) {

if (matched.pathAndMethod.length) {
for (var i = 0, l = matched.pathAndMethod.length; i < l; i++) {
i = matched.pathAndMethod.length;
while (i--) {
layer = matched.pathAndMethod[i];
ii = layer.stack.length;
this.captures = layer.captures(path, this.captures);

@@ -320,14 +322,16 @@ this.params = layer.params(path, this.captures, this.params);

for (var ii = 0, ll = layer.stack.length; ii < ll; ii++) {
while (ii--) {
if (layer.stack[ii].constructor.name === 'GeneratorFunction') {
next = layer.stack[ii].call(this, next);
yield *next;
} else {
next = Promise.resolve(layer.stack[ii].call(this, next));
yield next;
}
}
}
}
if (typeof next.next === 'function') {
yield *next;
} else {
yield *next;
yield next;
}

@@ -334,0 +338,0 @@ };

@@ -13,3 +13,3 @@ {

"author": "Alex Mingoia <talk@alexmingoia.com>",
"version": "5.2.0",
"version": "5.2.1",
"keywords": [

@@ -38,3 +38,3 @@ "koa",

"scripts": {
"test": "NODE_ENV=test node --harmony-generators node_modules/gulp/bin/gulp.js test",
"test": "[ \"${TRAVIS_NODE_VERSION}\" = \"0.12\" ] && NODE_ENV=test node --harmony-generators node_modules/gulp/bin/gulp.js test || NODE_ENV=test node node_modules/gulp/bin/gulp.js test",
"docs": "NODE_ENV=test node node_modules/gulp/bin/gulp.js docs"

@@ -41,0 +41,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc