enumeration-class
v1.0.0
Published
Enumeration in JavaScript
Downloads
4
Maintainers
Readme
Enumeration Class
Immutable Properties
binary example
const suits = new Enumeration({
spades: null,
diamonds: null,
hearts: null,
clubs: null,
})
console.info(suits.has('hearts')) // TRUE
console.info(suits.has('joker')) // FALSE
suits.spades = 'clubs' // Error
suits.joker = 'I am a suit!' // Error
value example
const classes = new Enumeration({
element: 'my-awesome-element',
visible: 'my-awesome-element--visible',
})
console.info(classes.element) // prints "my-awesome-element"
Todo
- [ ] Add Test Coverage.