updated based on cvle's feedback

This commit is contained in:
Wyatt Johnson
2017-08-31 11:48:38 -06:00
parent 7b71511cae
commit dfd77dbf63
4 changed files with 15 additions and 17 deletions
+2 -5
View File
@@ -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.`);
}