https://github.com/fega/enum
Javascript enums done right
https://github.com/fega/enum
Last synced: 6 months ago
JSON representation
Javascript enums done right
- Host: GitHub
- URL: https://github.com/fega/enum
- Owner: fega
- Created: 2019-02-19T19:00:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-19T21:52:10.000Z (almost 7 years ago)
- Last Synced: 2025-01-10T18:25:59.831Z (about 1 year ago)
- Language: JavaScript
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Enums
> enums done right
## Usage
```javascript
const enums = require('@fega/enums')
const myEnum = enums('DOG','CAT','RAT')
console.log(myEnum.DOG) // prints "DOG"
console.log(Object.keys(myEnum)) // prints ["DOG","CAT","RAT"]
console.log(myEnum.DRAGON) // WILL throw an error
myEnum.DRAGON='please no' //Will throw an error
```
## license
MIT