import { AsyncReducer } from "https://deno.land/x/rimbu@1.2.0/core/mod.ts";
const { fold } = AsyncReducer;
Returns an AsyncReducer
that uses the given init
and next
values to fold the input values into
result values.
Parameters
init: AsyncOptLazy<R>
- an (optionally lazy) initial result value
next: () => MaybePromise<R>
- a (potentially async) function taking the following arguments:
- current - the current result value
- value - the next input value
- index: the input index value
- halt: function that, when called, ensures no more elements are passed to the reducer