An open API service indexing awesome lists of open source software.

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

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