From 9bcc347a9a5f76277eb5e4e30d267e90166288a6 Mon Sep 17 00:00:00 2001 From: popomore Date: Sun, 22 Jan 2017 15:41:09 +0800 Subject: [PATCH] fix: use yield instead of yield* --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 9c0a8c7..3c2b7d9 100644 --- a/index.js +++ b/index.js @@ -135,7 +135,7 @@ KoaRoles.prototype.use2 = function (action, fn) { var fn = roles.actionMap[action]; if (act === action) { if (is.generatorFunction(fn)) { - return yield* fn.call(this); + return yield fn.call(this); } else { return fn.call(this); } @@ -150,11 +150,11 @@ KoaRoles.prototype.use2 = function (action, fn) { KoaRoles.prototype.can = function (action) { var roles = this; return function *(next) { - if (yield* roles.test(this, action)) { - return yield* next; + if (yield roles.test(this, action)) { + return yield next; } if (is.generatorFunction(roles.failureHandler)) { - yield* roles.failureHandler.call(this, action); + yield roles.failureHandler.call(this, action); } else { roles.failureHandler.call(this, action); } @@ -177,7 +177,7 @@ KoaRoles.prototype.test = function *(ctx, action) { var fn = this.functionList[i]; var vote = null; if (is.generatorFunction(fn)) { - vote = yield* fn.call(ctx, action); + vote = yield fn.call(ctx, action); } else { vote = fn.call(ctx, action); } @@ -205,13 +205,13 @@ KoaRoles.prototype.middleware = function (options) { } } this.userIs = this.userCan = roleCheck; - yield* next; + yield next; }; }; function tester(roles, ctx) { - return function *(action) { - return yield* roles.test(ctx, action); + return function* (action) { + return yield roles.test(ctx, action); }; }