another-enum

1.0.1 • Public • Published

ANOTHER-ENUM changelog

Another enum module, nothing more


npm install

docs build tests coverage audit dependencies


Simple usage

Advanced usage

Methods listing

Import

import { Enum } from 'another-enum'
// Or
const Enum = require('another-enum').Enum

Basic instanciation

Enum.EnumName(NAME1, NAME2, ...)

Enum.EnumName({
   NAME1: value1,
   NAME2: value2,
   ...
})

See also: Enum Constructors

See also: Instanciation with base

See also: Custom methods

Examples

const Colors = Enum.Colors('RED', 'GREEN', 'BLUE')

const HexaColors = Enum.HexaColors(16, {
    RED: 0xFF0000,
    GREEN: 0x00FF00,
    BLUE: 0x0000FF
})
// For more explanation, you should take a look at:
// - Enum constructors
// - Instanciation with base
// Some nice constructors
// Automatic incrementation
Enum.Values({
    VALUE1: 2,
    VALUE2: {}, // value: 3
    VALUE3: 8,
    VALUE4: {}, // value: 9
    VALUE5: {}  // value: 10
})
const obj = {
    [Values.VALUE1]: 'value1',
    [Values.VALUE2]: 'value2'
}
switch (color)
{
    case Values.VALUE1:
        // ...
        break
    case Values.VALUE2:
        // ...
        break
    default:
        // ...
}

version npm install

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.14latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.14
1.0.02
0.0.51
0.0.4-t21
0.0.4-t12
0.0.40
0.0.3-r21
0.0.3-r11
0.0.31
0.0.2-r11
0.0.20
0.0.11

Package Sidebar

Install

npm i another-enum

Weekly Downloads

15

Version

1.0.1

License

MIT

Unpacked Size

19.6 kB

Total Files

13

Last publish

Collaborators

  • magnaar