koa-router
Advanced tools
Comparing version 5.4.1 to 5.4.2
@@ -12,2 +12,3 @@ /** | ||
var Layer = require('./layer'); | ||
var co = require('co'); | ||
@@ -326,7 +327,6 @@ /** | ||
while (ii--) { | ||
if (layer.stack[ii].constructor.name === 'GeneratorFunction') { | ||
next = layer.stack[ii].call(this, next); | ||
} else { | ||
next = Promise.resolve(layer.stack[ii].call(this, next)); | ||
} | ||
var stack = layer.stack[ii].constructor.name === 'GeneratorFunction' | ||
? layer.stack[ii] | ||
: wrapAsyncToGenerator(layer.stack[ii]); | ||
next = stack.call(this, next); | ||
} | ||
@@ -336,7 +336,3 @@ } | ||
if (typeof next.next === 'function') { | ||
yield *next; | ||
} else { | ||
yield next; | ||
} | ||
yield *next; | ||
}; | ||
@@ -704,1 +700,9 @@ | ||
}; | ||
function wrapAsyncToGenerator(fn) { | ||
return function* (next) { | ||
var p = fn.call(this, co(next)); | ||
// only yield if return a promise | ||
if (p && typeof p.then === 'function') return yield p; | ||
} | ||
} |
@@ -13,3 +13,3 @@ { | ||
"author": "Alex Mingoia <talk@alexmingoia.com>", | ||
"version": "5.4.1", | ||
"version": "5.4.2", | ||
"keywords": [ | ||
@@ -22,2 +22,3 @@ "koa", | ||
"dependencies": { | ||
"co": "^4.6.0", | ||
"debug": "^2.2.0", | ||
@@ -24,0 +25,0 @@ "http-errors": "^1.3.1", |
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
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
41677
818
5