<abstract> new Enum(name)
Constructor.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | the name |
Members
-
name
-
Get the enum name.
Methods
-
<static> enumsValue(enums)
-
This method takes an array of enums and turns them into a mapped object, using the enum
nameas object property names.Parameters:
Name Type Description enumsArray.<module:util~Enum> the enum list to turn into a value object
Returns:
an object with enum
nameproperties with associated enum values- Type
- object
-
<abstract, static> enumValues()
-
Get all enum values.
This method must be overridden by subclasses to return something meaningful. This implementation returns an empty array.
Returns:
get all enum values
- Type
- Array.<module:util~Enum>
-
<static> valueOf(name)
-
Get an enum instance from its name.
This method searches the
module:util~Enum#enumVvaluesarray for a matching value.Parameters:
Name Type Description namestring the enum name to get an instnace for
Returns:
the instance, or
undefinedif no instance exists for the givenname- Type
- module:util~Enum
-
equals(value)
-
Test if a string is equal to this enum's name.
As long as enum values are consistently obtained from the
module:util~Enum.enumValuesarray then enum instances can be compared with===. If unsure, this method can be used to compare string values instead.Parameters:
Name Type Description valuestring the value to test
Returns:
trueifvalueis the same as this instance'snamevalue- Type
- boolean