Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

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.

Install

npm i constant-enum

DownloadsWeekly Downloads

56

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avatar