A predicate function that determines when a step should stop iterating.
The predicate is evaluated after each iteration with the current data. Returns an object with ok (success) and optional msg (failure reason).
const analyzeDone: Predicate = (data) => { const hasAnalysis = data && typeof data === 'object' && 'analysis' in data; return { ok: hasAnalysis, msg: hasAnalysis ? undefined : 'No analysis found' };}; Copy
const analyzeDone: Predicate = (data) => { const hasAnalysis = data && typeof data === 'object' && 'analysis' in data; return { ok: hasAnalysis, msg: hasAnalysis ? undefined : 'No analysis found' };};
Evaluate the predicate with the current data.
The current data state
Object with ok (true if predicate satisfied) and optional msg (why not satisfied)
A predicate function that determines when a step should stop iterating.
The predicate is evaluated after each iteration with the current data. Returns an object with ok (success) and optional msg (failure reason).
Example