Nominally Patriotic Meathead
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    typed-enumpublic

    typed-enum

    Enum Factory in Typed JavaScript.

    Build Status

    Example

    var Sex = Enum('male', 'female')
     
    //all expressions return true
    Sex.MALE instanceof Sex && Sex.FEMALE instanceof Sex
    Sex.MALE.value === 'male' && Sex.FEMALE.value === 'female'
    Sex.MALE == 'male' && Sex.FEMALE == 'female'
    JSON.stringify(Sex.MALE) === '"male"' && JSON.stringify(Sex.FEMALE) === '"female"'
    Sex.has('male') && Sex.has('female') && !Sex.has('foo')
    Sex('male') === Sex.MALE && Sex('female') === Sex.FEMALE

    Install

    Download Latest

    Download the compressed, production file

    Download the uncompressed, development file and the source map file

    NPM

    NPM version

    npm install typed-enum

    Bower

    Bower version

    bower install typed-enum

    Import

    CommonJS (Node.js), AMD (RequireJS), CMD (Sea.js)

    var Enum = require('typed-enum')

    Naked script

    <script src='path_to/enum.min.js'></script>
    <script>
    var Enum = MY_MODULES['typed-enum'].exports
    </script> 

    Development

    Issues

    https://github.com/hax/typed-enum/issues

    Build

    npm run build

    Test in Node.js

    npm test

    Test in browsers

    open test/index.html

    Keywords

    none

    install

    npm i typed-enum

    Downloadsweekly downloads

    9

    version

    0.1.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar