( initial: LazyArg<S>, f: (s: S, input: NonEmptyReadonlyArray<In>) => S )
| 1371 | if (!predicate(state)) { |
| 1372 | return Cause.done() |
| 1373 | } |
| 1374 | return Effect.void |
| 1375 | }), |
| 1376 | Effect.forever({ disableYield: true }), |
| 1377 | Pull.catchDone(() => Effect.succeed([state] as const)) |
| 1378 | ) |
| 1379 | }) |
| 1380 | |
| 1381 | /** |
| 1382 | * A sink that reduces its inputs using the provided function `f` starting from |
| 1383 | * the provided `initial` state. |
| 1384 | * |
| 1385 | * @category folding |
| 1386 | * @since 4.0.0 |
| 1387 | */ |
| 1388 | export const reduce = <S, In>(initial: LazyArg<S>, f: (s: S, input: In) => S): Sink<S, In> => |
| 1389 | reduceArray(initial, (s, arr) => { |
| 1390 | for (let i = 0; i < arr.length; i++) { |
no test coverage detected
searching dependent graphs…