"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAsyncHook = void 0;
function createAsyncHook() {
    const callbacks = [];
    const tap = (cb) => {
        callbacks.push(cb);
    };
    const call = async (...args) => {
        const params = args.slice(0);
        for (const cb of callbacks) {
            const result = await cb(...params);
            if (result !== undefined) {
                params[0] = result;
            }
        }
        return params;
    };
    return {
        tap,
        call,
    };
}
exports.createAsyncHook = createAsyncHook;
