Enum

Enum

An Enum consists of a set of predefined constants. These constants are accessible directly on the instance.

Constructor

new Enum(…constants)

Source:
Implements:
Parameters:
Name Type Attributes Description
constants String <repeatable>

Members

(readonly) length :Number

Description:
  • The amount of values/constants in this instance.
Source:
Implements:
The amount of values/constants in this instance.
Type:
  • Number

Methods

forEach(callback)

Description:
  • Iterates through this instances' values with a callback method.
Source:
Implements:
See:
Parameters:
Name Type Description
callback EnumLikeIteratorCallback

has(value) → {Boolean}

Description:
  • Checks whether a value belongs to this instance.
Source:
Implements:
Parameters:
Name Type Description
value EnumConstant
Returns:
Type
Boolean

serialize() → {String}

Description:
  • Serializes this instance.
Source:
Implements:
Returns:
Type
String

toString() → {String}

Description:
  • Gets a string representation of this instance.
Source:
Implements:
Returns:
A string representation of this instance.
Type
String

values() → {Array.<EnumConstant>}

Description:
  • Gets the values/constants of this instance.
Source:
Implements:
Returns:
The values/constants of this instance.
Type
Array.<EnumConstant>

(static) deserialize(input) → {Enum}

Description:
  • Deserializes a string and returns a new instance.
Source:
Parameters:
Name Type Description
input String
Throws:
In case input could not be parsed.
Type
Error
Returns:
A new instance.
Type
Enum

(static) fromArray(array) → {Enum}

Description:
  • Produces a new instance from an array.
Source:
Parameters:
Name Type Description
array Array.<String>
Returns:
A new instance.
Type
Enum