koa-convert
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -16,5 +16,7 @@ 'use strict' | ||
} | ||
return function (ctx, next) { | ||
const converted = function (ctx, next) { | ||
return co.call(ctx, mw.call(ctx, createGenerator(next))) | ||
} | ||
converted._name = mw._name || mw.name | ||
return converted | ||
} | ||
@@ -43,3 +45,3 @@ | ||
} | ||
return function * (next) { | ||
const converted = function * (next) { | ||
let ctx = this | ||
@@ -58,2 +60,4 @@ let called = false | ||
} | ||
converted._name = mw._name || mw.name | ||
return converted | ||
} |
{ | ||
"name": "koa-convert", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "koa", |
10
test.js
@@ -28,2 +28,7 @@ /* global describe, it */ | ||
it('should inherit the original middleware name', () => { | ||
let mw = convert(function * testing (next) {}) | ||
assert.strictEqual(mw._name, 'testing') | ||
}) | ||
it('should work with `yield next`', () => { | ||
@@ -200,2 +205,7 @@ let call = [] | ||
}) | ||
it('should inherit the original middleware name', () => { | ||
let mw = convert.back(function testing (ctx, next) {}) | ||
assert.strictEqual(mw._name, 'testing') | ||
}) | ||
}) | ||
@@ -202,0 +212,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
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
12295
277