(reducer: Reducer.Reducer<A>)
| 2470 | * @since 4.0.0 |
| 2471 | */ |
| 2472 | export function makeReducerFailFast<A>(reducer: Reducer.Reducer<A>): Reducer.Reducer<Option<A>> { |
| 2473 | const combine = makeCombinerFailFast(reducer).combine |
| 2474 | const initialValue = some(reducer.initialValue) |
| 2475 | return Reducer.make(combine, initialValue, (collection) => { |
| 2476 | let out = initialValue |
| 2477 | for (const value of collection) { |
| 2478 | out = combine(out, value) |
| 2479 | if (isNone(out)) return out |
| 2480 | } |
| 2481 | return out |
| 2482 | }) |
| 2483 | } |
nothing calls this directly
no test coverage detected