Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

promise-tap-then-catch

bluelovers4.5kISC1.0.4TypeScript support: included

Tap into a promise chain without affecting its value or state

create-by-yarn-tool, create-by-tsdx

readme

README.md

Tap a promise chain without affecting its value or state

install

yarn add promise-tap-then-catch
yarn-tool add promise-tap-then-catch
yt add promise-tap-then-catch
/**
 * Essentially like .then(), except that the value passed in is the value returned.
 * @see http://bluebirdjs.com/docs/api/tap.html
 */
export declare function promiseTapThen<P extends Promise<any>, V extends any = Awaited<P>>(promise: P,
    handler: (value: V, ...argv: any[]) => any
): P;

export declare type Constructor<E> = new (...args: any[]) => E;
export declare type ITapCatchArgvs<EC extends Constructor<unknown>> = [
    ...EC[],
    (reason: EC, ...argv: any[]) => any
];

/**
 * .tapCatch is a convenience method for reacting to errors without handling them with promises - similar to finally but only called on rejections. Useful for logging errors.
 * @see http://bluebirdjs.com/docs/api/tapCatch.html
 */
export declare function promiseTapCatch<P extends Promise<any>, E extends any = unknown, EC extends Constructor<any> = any>(promise: P,
    ...inputs: ITapCatchArgvs<EC> | [
        ((reason: E, ...argv: any[]) => any)
    ]
): P;

export declare function promiseTapThenCatch<P extends Promise<any>, V extends any = Awaited<P>, E extends any = unknown>(promise: P,
    handlerThen: (value: V, ...argv: any[]) => any,
    handlerCatch?: (reason: E, ...argv: any[]) => any
): P;

export declare function promiseTapLazyBoth<P extends Promise<any>, V extends any = Awaited<P>, E extends any = unknown>(promise: P,
    handlerThen: (value: V, ...argv: any[]) => any,
    handlerCatch?: (reason: E, ...argv: any[]) => any
): P;

export default promiseTapLazyBoth;

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.4 (2022-08-28)

🛠 Build System

1.0.3 (2022-03-28)

📦 Code Refactoring

1.0.2 (2022-02-15)

🔖 Miscellaneous

1.0.1 (2022-02-15)

🔖 Miscellaneous