enumjs
enumjs copied to clipboard
Type-safe enums in JavaScript
Not sure if the name makes the most sense, but i'd like to be able to associate data with enum variants and work with them like you can [here](https://play.rust-lang.org/?code=fn%20main%28%29%20{%0A%20%20%20%20enum%20Message%20{%0A%20%20%20%20%20%20%20%20Move%20{%20x%3A%20i32%2C%20y%3A%20i32%20}%2C%0A%20%20%20%20}%0A%20%20%20%20let%20x%3A%20Message%20%3D%20Message%3A%3AMove%20{%20x%3A%203%2C%20y%3A%204%20}%3B%0A%20%20%20%20%0A%20%20%20%20enum%20BoardGameTurn%20{%0A%20%20%20%20%20%20%20%20Move%20{%20squares%3A%20i32%20}%2C%0A%20%20%20%20%20%20%20%20Pass%2C%0A%20%20%20%20}%0A%20%20%20%20%0A%20%20%20%20let%20y%3A%20BoardGameTurn%20%3D%20BoardGameTurn%3A%3AMove%20{%20squares%3A%201%20}%3B%0A%20%20%20%20%0A}) Example...