Function ifUndefinedThenWithReturn

Executes a callback if the value is undefined and returns the result

  • Type Parameters

    • T

      The type of the value

    Parameters

    • callback: (() => T)

      The callback function to execute that returns a value

        • (): T
        • Returns T

    • Optionalvalue: T

      The value to check (optional)

    Returns T

    The result of the callback if value is undefined, otherwise the original value