(reducer: Reducer.Reducer<A>)
| 2549 | * @since 4.0.0 |
| 2550 | */ |
| 2551 | export function makeReducerFailFast<A>(reducer: Reducer.Reducer<A>): Reducer.Reducer<Option<A>> { |
| 2552 | const combine = makeCombinerFailFast(reducer).combine |
| 2553 | const initialValue = some(reducer.initialValue) |
| 2554 | return Reducer.make(combine, initialValue, (collection) => { |
| 2555 | let out = initialValue |
| 2556 | for (const value of collection) { |
| 2557 | out = combine(out, value) |
| 2558 | if (isNone(out)) return out |
| 2559 | } |
| 2560 | return out |
| 2561 | }) |
| 2562 | } |
nothing calls this directly
no test coverage detected