API reference › @evolu/common › Schedule › repetitions
function repetitions<Output, Input>(
schedule: Schedule<Output, Input>,
): Schedule<number, Input>;
Defined in: packages/common/src/Schedule.ts:1570
Wraps a schedule to output the number of repetitions instead of original output.
Outputs 0, 1, 2, ... while preserving the underlying schedule's timing and termination behavior.
Counting repetitions
import {
assertOk,
exponential,
repetitions,
testCreateDeps,
} from "@evolu/common";
// Count retries while preserving exponential timing.
const step = repetitions(exponential("100ms"))(testCreateDeps());
assertOk(step(undefined), [0, 100]);
assertOk(step(undefined), [1, 200]);