A collection of extension methods for Enums

Usage:

  • use this extension by adding this where you normally import modules: using zero.extensions.EnumExt;
  • now you can use any of these functions on different arrays: MyEnum.get_random();
  • or use all of the extensions in this library by adding: using zero.extensions.Tools;

Static methods

staticinlineall<T> (e:Enum<T>):Array<T>

Get an array of all enums, shortcut for Type.allEnums()

Parameters:

e

input

Returns:

Array return [for (e in Type.allEnums(e)) e]

staticinlineget_random<T> (e:Enum<T>):T

Returns a random enum value from input

Parameters:

e

input

Returns:

T return e.all().get_random()