loop-controls
Version:
break/continue controls for loops and higher-order functions (sync, async, concurrent). Designed to compose with ts-pattern.
9 lines • 618 B
TypeScript
import { type Control } from "./core.js";
export declare function forEachAsync<T>(iter: AsyncIterable<T> | Iterable<T>, fn: (item: T, control: Control, index: number) => Promise<void>): Promise<{
broken: false;
} | {
broken: true;
}>;
export declare function reduceAsync<T, A>(iter: AsyncIterable<T> | Iterable<T>, seed: A, fn: (acc: A, item: T, control: Control, index: number) => Promise<A>): Promise<A>;
export declare function findAsync<T>(iter: AsyncIterable<T> | Iterable<T>, fn: (item: T, control: Control, index: number) => Promise<boolean>): Promise<T | undefined>;
//# sourceMappingURL=async.d.ts.map