0.3.0 • Published 9 years ago

enumit v0.3.0

Weekly downloads
21
License
-
Repository
github
Last release
9 years ago

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.
0.3.0

9 years ago

0.2.0

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago