Skip to content

Commit

Permalink
Merge 9bcc347 into bce7f17
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Jan 22, 2017
2 parents bce7f17 + 9bcc347 commit ebe8c4e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions index.js
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
};
}

Expand Down

0 comments on commit ebe8c4e

Please sign in to comment.