JefferyLiang / koa-2-acl

ACL middleware of koa 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: role.map is not a function

fancyoung opened this issue · comments

It seems using if (typeof role.length) { to identify array, but it is true when role is a string.
So will show error: TypeError: role.map is not a function.

Why not use if (typeof role == 'object') {?

https://github.com/JefferyLiang/koa-2-acl/blob/master/lib/index.js#L57

But when I update it, there will be other error.
It seems the code is not updated correctly, and some config like multipleRolePropertyName is not in document.

I made a pull request #24 . I'm not sure it's correct, but it's working for me.