import { type LoopParams } from "./loop"; import { type AnyValue } from "./types/anyValue"; interface LoopOutputExistResult { "-exitData": GenericOutput; } interface LoopOutputNextResult { "-nextData": GenericOutput; } /** * The asyncLoop() function is the asynchronous variant of loop. Each iteration can return a promise before deciding to continue (next) or exit (exit). * * Signature: `asyncLoop(from, theFunction)` → returns a value * * The input value is not mutated. * * ```ts * const result = await asyncLoop( * async({ count, previousOutput, next, exit }) => { * const current = (previousOutput ?? 0) + 1; * * await Promise.resolve(); * * if (count >= 2) { * return exit(current); * } * * return next(current); * }, * ); * // result: 3 * ``` * * @see https://utils.duplojs.dev/en/v1/api/common/asyncLoop * */ export declare function asyncLoop(loop: (params: LoopParams) => Promise | LoopOutputExistResult>): Promise; export {};