Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save willnguyen1312/cd7639edb449288fd487f28ec3d80e2f to your computer and use it in GitHub Desktop.
Save willnguyen1312/cd7639edb449288fd487f28ec3d80e2f to your computer and use it in GitHub Desktop.
javascript bitmask permissions
fnMayI=function(intPerms,strPerm){
//intPerms is an dec number that conatins all of the permissions
//set these to your permissions map these are the binary positions of intPerms
var objPerms={
"read":1
,"update":2
,"create":4
,"props":16
,"delete":64
,"perms":65536
};
//return truthy falsey
return intPerms&objPerms[strPerm];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment