Type Parameters

  • E

  • K extends string = string

Hierarchy

Constructors

  • Type Parameters

    • E

    • K extends string = string

    Parameters

    • enumObject: Record<K, E>

      The full enumeration.

    • n: number = 0

      The starting position of the cursor. Defaults to 0.

    Returns default<E, K>

Properties

cursor: number
default: number | (() => number)
enumObject: any
event: IEventEmitter<default<E, K>, IEnumCursorEvents<E>>
values: E[]

Methods

  • Filters the valid enum entries. This causes the internal list of enum entries to be refreshed. If the cursor has been set previously, it will likely be moved to a different entry.

    Parameters

    • filter: ((name: string, value: E) => boolean)

      A function that takes a name and enum value and returns whether the entry should be included.

        • (name: string, value: E): boolean
        • Parameters

          • name: string
          • value: E

          Returns boolean

    Returns default<E, K>

  • Returns the entry at the cursor position.

    Returns E

  • Retrieves a random cursor position

    Returns number

  • If the given amount is positive, moves forward that many entries. If the given amount is negative, moves backward that many entries.

    Returns

    The entry at the new cursor position.

    Parameters

    • amt: number

    Returns E

  • Sets the cursor position.

    Parameters

    • n: number

    Returns default<E, K>

  • Moves to the default cursor position.

    Returns E

  • Sets the cursor position to the position of this enum entry in the filtered list.

    Returns

    The entry at the new cursor position.

    Parameters

    • entry: E

    Returns E

  • Moves the cursor to a random entry, then returns that entry.

    Returns E

  • Moves the cursor forward one entry, and returns the new entry.

    Returns E

  • Moves the cursor backward one entry, and returns the new entry.

    Returns E

  • Refreshes the internal list of enum entries. If the full enumeration has changed, the cursor may be moved to a different entry.

    Returns default<E, K>

  • Sets the default cursor position.

    Parameters

    • n: number

    Returns default<E, K>

  • Sets a handler for retrieving the default cursor position.

    Parameters

    • generator: (() => number)
        • (): number
        • Returns number

    Returns default<E, K>

  • Sets a handler for retrieving the default cursor position to a pre-implemented method by EnumCursorDefaultGenerator entry.

    Parameters

    Returns default<E, K>

  • Sets the default cursor position to the position of the given entry in this cursor.

    Parameters

    • entry: E

    Returns default<E, K>

Generated using TypeDoc