mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
updated based on cvle's feedback
This commit is contained in:
+2
-5
@@ -41,11 +41,8 @@ const findGrant = (user, perms) => {
|
||||
*/
|
||||
module.exports = (user, ...perms) => {
|
||||
|
||||
// make sure all the passed permissions are not typos
|
||||
const missingPerms = perms.filter((perm) => {
|
||||
return allPermissions.indexOf(perm) === -1;
|
||||
});
|
||||
|
||||
// Make sure all the passed permissions are not typos.
|
||||
const missingPerms = perms.filter((perm) => !allPermissions.includes(perm));
|
||||
if (missingPerms.length > 0) {
|
||||
throw new Error(`${missingPerms.join(' ')} are not valid permissions.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user