• Create an async handler which will either return a value to a supplied callback, or call the appropriate method on the promise resolve/reject.

    Returns

    The returned function takes two arguments (err, value). If the the callback is a function the two arguments will be passed through to the callback in the same order. If no callback is supplied, the promise resolve or reject method will be called depending on the existence of an error value.

    Type Parameters

    • T

    Parameters

    • Optional callback: Callback<T>

      The optional callback.

    • Optional resolve: ((value: T) => void)

      The optional promise resolve function.

        • (value: T): void
        • Parameters

          • value: T

          Returns void

    • Optional reject: ((error: CallbackError) => void)

      The optional promise reject function.

        • (error: CallbackError): void
        • Parameters

          • error: CallbackError

          Returns void

    • Optional transform: ((value: T) => T)

      The optional response transform function.

        • (value: T): T
        • Parameters

          • value: T

          Returns T

    Returns {
        reject: ((error: CallbackError) => void);
        resolve: ((value: T) => void);
    }

    • reject: ((error: CallbackError) => void)
        • (error: CallbackError): void
        • Parameters

          • error: CallbackError

          Returns void

    • resolve: ((value: T) => void)
        • (value: T): void
        • Parameters

          • value: T

          Returns void

Generated using TypeDoc