import { type AnyValue } from "./types/anyValue"; interface LoopOutputExistResult { "-exitData": GenericOutput; } interface LoopOutputNextResult { "-nextData": GenericOutput; } export interface LoopParams { count: number; previousOutput: GenericRawNextOutput | undefined; next(output?: GenericValue): LoopOutputNextResult; exit(output?: GenericOutput): LoopOutputExistResult; } /** * The loop() function runs a loop controlled via the next and exit callbacks. Each iteration receives the counter and the previous output to drive the flow. * * Signature: `loop(from, theFunction)` → returns a value * * The input value is not mutated. * * ```ts * const result = loop( * ({ previousOutput, next, exit }) => { * const current = (previousOutput ?? 0) + 1; * if (current >= 5) { * return exit(current); * } * * return next(current); * }, * ); * // result: 5 * ``` * * @see https://utils.duplojs.dev/en/v1/api/common/loop * */ export declare function loop(loop: (params: LoopParams) => LoopOutputNextResult | LoopOutputExistResult): GenericRawExitOutput; export {};