constant-enum

1.0.1 • Public • Published

Build Status 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.

Package Sidebar

Install

npm i constant-enum

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • dakuan