API reference@evolu/commonSchedule › collectUntilScheduleOutput

function collectUntilScheduleOutput<Output>(
  predicate: Predicate<Output>,
): <Input>(
  schedule: Schedule<Output, Input>,
) => Schedule<readonly Output[], Input>;

Defined in: packages/common/src/Schedule.ts:1221

Collects outputs until a predicate becomes true.

Mirror of collectWhileScheduleOutput — stops collecting when the predicate returns true (inclusive of the matching output).

Example

// Collect delays until reaching 1 second
const untilLarge = collectUntilScheduleOutput((delay: Millis) => delay >= 1000)(
  exponential("100ms"),
);
// Outputs: [100], [100, 200], [100, 200, 400], [100, 200, 400, 800], stops