Simple Enum
Provides an elegant API for non-algebraic Enumerations in javascript.
This library also provides a clever shorthand mechanism for checking the value of an enum which is very convenient for switching on properties of an enumeration.
var KEY_STATE = 'UP' 'DOWN' 'JUST_DOWN' 'JUST_UP' var C = KEY_STATEJUST_DOWNvar CTRL = KEY_STATEDOWN if CJUST_DOWN && CTRLDOWN // Do copy stuff for your app
In particular, this library is more convenient and less verbose than the alternative which would look something like this
if C === KEY_STATEJUST_DOWN && CTRL === KEY_STATEDOWN // Do copy stuff for your app
Tests and Build
To run the test, use npm run test