Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es6-enum

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-enum

Enum type made by es6

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
548
increased by41.97%
Maintainers
1
Weekly downloads
 
Created
Source

es6-enum

Version js-standard-style npm download Circle CI

Installation

npm install es6-enum

Usage

import Enum from "es6-enum"

const ORIENTATION = Enum("NORTH", "SOUTH", "WEST", "EAST")
const ORIEN = Enum("NORTH", "SOUTH", "WEST", "EAST")

typeof ORIENTATION.NORTH                      // "symbol"

ORIENTATION.NORTH === ORIENTATION.NORTH       // true
ORIENTATION.NORTH === ORIEN.NORTH             // false

export ORIENTATION

In practice

I like use this package to define constant in Redux

constant.js
  const APPLICATION = Enum('USER')

action.js
  dispatch({
    type: APPLICATION.USER,
    data
  })

reducer.js
  [APPLICATION.USER]: (state, action) => {
    ...
  }

License

MIT

Keywords

FAQs

Package last updated on 12 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc