Class

EnumBase

EnumBase()

Constructor

new EnumBase()

Base class for all enum likes

Methods

getEnumName() → {String}

Gets the name of the Enum class.

String

getValue(valueOrLabel) → {String}

Gets the enum value of the provided value or label value. Case sensitive for values, case insensitive for labels.

Parameters:
Name Type Description
valueOrLabel String

The value or the label.

If the valueOrLabel args is not a value or a label.

Error

The enum value for the provided value or label.

String

hasLabel(testedLabel) → {Boolean}

Checks if the provided label is in the enum.

Parameters:
Name Type Description
testedLabel String

The label to be checked.

True if the provided label is in the enum, false otherwise.

Boolean

hasProperty(testedPropertyName) → {Boolean}

Checks if the provided value is a property of the enum.

Parameters:
Name Type Description
testedPropertyName String

The searched property.

True if the provided value is a property of the enum, false otherwise.

Boolean

hasValue(testedValue) → {Boolean}

Checks if the provided value is an existing value (case sensitive).

Parameters:
Name Type Description
testedValue String

The value to be checked.

True if the provided value exists, false otherwise.

Boolean

hasValueOrLabelOrProperty(valueOrLabelOrProperty) → {Boolean}

Checks if the provided value is in the enum as a label or a value.

Parameters:
Name Type Description
valueOrLabelOrProperty

The value, label or property.

True if the value, label or property is in the enum as a label or a value, false otherwise.

Boolean

tryGetValue(valueOrLabel) → {String|null}

Gets the enum value for the provided value or label value. Case sensitive for values, case insensitive for labels.

Parameters:
Name Type Description
valueOrLabel String

The value or the label.

The enum value for the provided value or label if exists, otherwise null.

String | null