Function ifDefinedThenWithReturn

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

  • Type Parameters

    • T

      The type of the value

    Parameters

    • callback: ((value: T) => T)

      The callback function to execute that returns a value

        • (value): T
        • Parameters

          • value: T

          Returns T

    • Optionalvalue: T

      The value to check (optional)

    Returns undefined | T

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