constant-enum
v1.0.1
Published
creates a frozen object with matching keys and values
Downloads
5
Maintainers
Readme
constant-enum
Generates a frozen object with matching keys and values
Installation
$ npm install constant-enum
Usage
var en = require('constant-enum');
en('MON', 'TUES', 'WEDS');
// or
en.apply(null, ['MON', 'TUES', 'WEDS']);
// results in ->
{
MON: 'MON',
TUES: 'TUES',
WEDS: 'WEDS'
}
Why?
We found this pattern helpful when implementing Facebook's Flux architecture. We use this pattern as an alterative to the one demonstrated in the Flux TodoMVC example.