Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SuddenDevelopment/09718b4b60838b0c696fef00f5a6c7d1 to your computer and use it in GitHub Desktop.
Save SuddenDevelopment/09718b4b60838b0c696fef00f5a6c7d1 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