Skip to content

Instantly share code, notes, and snippets.

@nw
Forked from anutron/parsePermissions
Created May 22, 2009 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nw/115831 to your computer and use it in GitHub Desktop.
Save nw/115831 to your computer and use it in GitHub Desktop.
Number.implement({
parsePermissions : function(){
var types = {r : 4, w : 2, x : 1 }, levels = {u : 1, g : 8, o : 64 }, perms = {};
for(l in levels){
for(t in types) perms[l+t] = !!(this & (levels[l] * types[t]));
}
return perms;
}
});
(33188).parsePermissions();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment