import { __read, __spread } from "tslib";
import { createBatcher } from "./base";
export var createIndexedBatcher = function (waitTime, cb) {
    return createBatcher({
        waitTime: waitTime,
        addCall: function (_a) {
            var batchArgs = _a.batchArgs, args = _a.args;
            if (batchArgs === undefined) {
                return [args[0]];
            }
            return __spread(batchArgs, [args[0]]);
        },
        createCallResult: function (batchResult, index) { return batchResult[index]; },
        processBatch: cb,
    });
};
