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

enumit

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enumit

An enum type for JS!

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

Enumit

Super simple Enum's for JavaScript.

var Enum = require("enumit");

var State = new Enum("ON", "OFF");

var myState = State.ON; // myState is an instanceof EnumValue (private class of Enum)
var value = myState.value; // Sets `value` to "ON"
var num1 = State.ON.toNumber(); // Sets `num1` to 1
var num2 = State.OFF.toNumber(); // Sets `num2` to 2

console.log(State.ON); // Calls toString() which in turns returns the value "ON"

Githooks

For developers contributing to this repo's source code, please run the following npm script:

npm run githooks

This script provides:

  • pre commit: Runs jshint before commit is added to history.
  • pre push: Runs tests before code is pushed up to remote.

FAQs

Package last updated on 01 Jul 2015

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