Class: Constants

Constants()

Defines a helper method for accessing constants.

Constructor

new Constants()

Source:

Methods

(static) createFromArray(dataArray) → {object}

Parameters:
Name Type Description
dataArray Array.<string> A list of strings.
Source:
Returns:
An object with keys that can be used as constants.
Type
object
Example
// The array ['String One', 'String Two'] is converted to the object:
{
  STRING_ONE: 'String One',
  STRING_TWO: 'String Two'
}

// These values can now be accessed as constants:
constantObject.STRING_ONE
constantObject.STRING_TWO