Function transformMaybePromise

  • Transforms the value within the promise.

    Type Parameters

    • T
    • R

    Parameters

    • value: Promise<T>
    • transformer: ((value: T) => R)
        • (value): R
        • Parameters

          • value: T

          Returns R

    Returns Promise<R>

    a new promise with the transformed result.

  • Transforms the value, or if the value is a promise, transform the resolved value of the promise.

    Type Parameters

    • T
    • R

    Parameters

    • value: T
    • transformer: ((value: T) => R)
        • (value): R
        • Parameters

          • value: T

          Returns R

    Returns T extends Promise<any>
        ? Promise<R>
        : R

    the transformed result, or if the value is a promise, a new promse with the transformed result.