Skip to content

Instantly share code, notes, and snippets.

@TheAlchemist64
Created July 20, 2017 17:55
Show Gist options
  • Save TheAlchemist64/55c7f55899de7f19118028ee55fcea77 to your computer and use it in GitHub Desktop.
Save TheAlchemist64/55c7f55899de7f19118028ee55fcea77 to your computer and use it in GitHub Desktop.
An Enum type for ES6
export default class Enum{
constructor(){
let args = Array.prototype.slice.call(arguments);
let i = 0;
args.forEach((val)=>{
this[val] = i++;
});
Object.freeze(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment