Class If<T>

An inline if/else statement class, with optional elseifs.

Type Parameters

  • T

Hierarchy

  • If

Constructors

Properties

Methods

Constructors

  • Create the class

    Type Parameters

    • T

    Parameters

    • truthy: (() => boolean)

      The truthy evaluator for the first if

        • (): boolean
        • Returns boolean

    • value: (() => T)

      Function to return the value if the statement is truthy

        • (): T
        • Returns T

    Returns If<T>

Properties

#truthy: (() => boolean)

Type declaration

    • (): boolean
    • Returns boolean

#value: (() => T)

Type declaration

    • (): T
    • Returns T

Methods

  • Get the final value from the statement.

    Returns

    Parameters

    • value: (() => T)

      Function to return the value if all previous if statements were falsy

        • (): T
        • Returns T

    Returns T

  • Add an else if to the inline statement

    Returns

    Parameters

    • truthy: (() => boolean)

      The truthy evaluator for the first if

        • (): boolean
        • Returns boolean

    • value: (() => T)

      Function to return the value if the statement is truthy

        • (): T
        • Returns T

    Returns If<T>

Generated using TypeDoc