Enumish
Easily create Enum-like objects.
Installation
npm install enumish --save
Usage
Basic
Import the library and invoke it with a list of strings (for mirrored values):
; // basic usageconst Directions = ; // resultDirectionsTOP === 'TOP'; // true
Custom values
Some of the arguments can be objects, for custom values:
// custom valuesconst SideBarComponents = ; // resultSideBarComponentsICON_PICKER === 'ICON_PICKER'; // trueSideBarComponentsLAYOUT_SELECTOR === 'LayoutSelector'; // true
Converter function
You can supply the keys as an array, and a converter function for the second argument:
// custom converter function as the second argumentconst Icons = ; // resultIconsBOLD === 'bold'; // true
Further usage can be found in the tests.
Test
npm run test
Configuration
Built using Library Starter Light.
License
MIT