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

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

Methods

(static) deserialize(input) → {Enum}

Source:
Deserializes a string and returns a new instance.
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}

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

forEach(callback)

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

has(value) → {Boolean}

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

serialize() → {String}

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

toString() → {String}

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

values() → {Array.<EnumConstant>}

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