Variable: reduceConcur()
const
reduceConcur: {<Value
,Acc
,Finished
,This
>(asyncReducer
,concurIterable
):Promise
<Finished
>; <Value
,Acc
,Finished
,This
>(asyncReducer
): (concurIterable
) =>Promise
<Finished
>; <Value
,Acc
,This
>(asyncReducer
,concurIterable
):Promise
<Acc
>; <Value
,Acc
,This
>(asyncReducer
): (concurIterable
) =>Promise
<Acc
>; <Value
,Finished
,This
>(asyncReducer
,concurIterable
):ConcurOptional
<Finished
>; <Value
,Finished
,This
>(asyncReducer
): (concurIterable
) =>ConcurOptional
<Finished
>; <Value
,This
>(asyncReducer
,concurIterable
):ConcurOptional
<Value
>; <Value
,This
>(asyncReducer
): (concurIterable
) =>ConcurOptional
<Value
>; <Value
>(asyncReducer
,concurIterable
):ConcurOptional
<Value
>; <Value
>(asyncReducer
): (concurIterable
) =>ConcurOptional
<Value
>; }
Defined in: reducers.d.ts:840
Returns the result of reducing the concurIterable
using asyncReducer
.
Informally, an initial accumulator is created using
RawAsyncReducerWithoutFinish.create. Then each value in
concurIterable
is added to the accumulator and the current accumulator is
updated using RawAsyncReducerWithoutFinish.add. Finally, the
resulting accumulator is transformed using
RawAsyncReducerWithFinish.finish if specified. Multiple accumulators
may be created, added to, and then combined if supported via
RawAsyncReducerWithoutFinish.combine and the next value of
concurIterable
is ready before promises from
RawAsyncReducerWithoutFinish.add resolve.
If asyncReducer
is an async optional reducer (no
RawAsyncReducerWithoutFinish.create method), then an empty concur
iterable is returned if concurIterable
is empty. Otherwise, an concur
iterable containing the result of reducing using the first value of the
concur iterable as the initial accumulator is returned.
Like Array.prototype.reduce
, but for concur iterables.
Call Signature
<
Value
,Acc
,Finished
,This
>(asyncReducer
,concurIterable
):Promise
<Finished
>
Type Parameters
Value
Value
Acc
Acc
Finished
Finished
This
This
Parameters
asyncReducer
RawAsyncReducerWithFinish
<Value
, Acc
, Finished
, This
> | RawReducerWithFinish
<Value
, Acc
, Finished
, This
>
concurIterable
ConcurIterable
<Value
>
Returns
Promise
<Finished
>
Call Signature
<
Value
,Acc
,Finished
,This
>(asyncReducer
): (concurIterable
) =>Promise
<Finished
>
Type Parameters
Value
Value
Acc
Acc
Finished
Finished
This
This
Parameters
asyncReducer
RawAsyncReducerWithFinish
<Value
, Acc
, Finished
, This
> | RawReducerWithFinish
<Value
, Acc
, Finished
, This
>
Returns
(
concurIterable
):Promise
<Finished
>
Parameters
concurIterable
ConcurIterable
<Value
>
Returns
Promise
<Finished
>
Call Signature
<
Value
,Acc
,This
>(asyncReducer
,concurIterable
):Promise
<Acc
>
Type Parameters
Value
Value
Acc
Acc
This
This
Parameters
asyncReducer
RawAsyncReducerWithoutFinish
<Value
, Acc
, This
> | RawReducerWithoutFinish
<Value
, Acc
, This
>
concurIterable
ConcurIterable
<Value
>
Returns
Promise
<Acc
>
Call Signature
<
Value
,Acc
,This
>(asyncReducer
): (concurIterable
) =>Promise
<Acc
>
Type Parameters
Value
Value
Acc
Acc
This
This
Parameters
asyncReducer
RawAsyncReducerWithoutFinish
<Value
, Acc
, This
> | RawReducerWithoutFinish
<Value
, Acc
, This
>
Returns
(
concurIterable
):Promise
<Acc
>
Parameters
concurIterable
ConcurIterable
<Value
>
Returns
Promise
<Acc
>
Call Signature
<
Value
,Finished
,This
>(asyncReducer
,concurIterable
):ConcurOptional
<Finished
>
Type Parameters
Value
Value
Finished
Finished
This
This
Parameters
asyncReducer
RawAsyncOptionalReducerWithFinish
<Value
, Finished
, This
> | RawOptionalReducerWithFinish
<Value
, Finished
, This
>
concurIterable
ConcurIterable
<Value
>
Returns
ConcurOptional
<Finished
>
Call Signature
<
Value
,Finished
,This
>(asyncReducer
): (concurIterable
) =>ConcurOptional
<Finished
>
Type Parameters
Value
Value
Finished
Finished
This
This
Parameters
asyncReducer
RawAsyncOptionalReducerWithFinish
<Value
, Finished
, This
> | RawOptionalReducerWithFinish
<Value
, Finished
, This
>
Returns
(
concurIterable
):ConcurOptional
<Finished
>
Parameters
concurIterable
ConcurIterable
<Value
>
Returns
ConcurOptional
<Finished
>
Call Signature
<
Value
,This
>(asyncReducer
,concurIterable
):ConcurOptional
<Value
>
Type Parameters
Value
Value
This
This
Parameters
asyncReducer
RawAsyncOptionalReducerWithoutFinish
<Value
, This
> | RawOptionalReducerWithoutFinish
<Value
, This
>
concurIterable
ConcurIterable
<Value
>
Returns
ConcurOptional
<Value
>
Call Signature
<
Value
,This
>(asyncReducer
): (concurIterable
) =>ConcurOptional
<Value
>
Type Parameters
Value
Value
This
This
Parameters
asyncReducer
RawAsyncOptionalReducerWithoutFinish
<Value
, This
> | RawOptionalReducerWithoutFinish
<Value
, This
>
Returns
(
concurIterable
):ConcurOptional
<Value
>
Parameters
concurIterable
ConcurIterable
<Value
>
Returns
ConcurOptional
<Value
>
Call Signature
<
Value
>(asyncReducer
,concurIterable
):ConcurOptional
<Value
>
Type Parameters
Value
Value
Parameters
asyncReducer
FunctionReducer
<Value
> | AsyncFunctionReducer
<Value
>
concurIterable
ConcurIterable
<Value
>
Returns
ConcurOptional
<Value
>
Call Signature
<
Value
>(asyncReducer
): (concurIterable
) =>ConcurOptional
<Value
>
Type Parameters
Value
Value
Parameters
asyncReducer
AsyncFunctionReducer
<Value
> | FunctionReducer
<Value
>
Returns
(
concurIterable
):ConcurOptional
<Value
>
Parameters
concurIterable
ConcurIterable
<Value
>
Returns
ConcurOptional
<Value
>
Example
console.log(
await pipe(
asAsync([`Hello`, `World!`, `What`, `an`, `interesting`, `program!`]),
reduceAsync((a, b) => `${a} ${b}`),
getAsync,
),
)
//=> Hello World! What an interesting program!
console.log(
await pipe(
asAsync([`Hello`, `World!`, `What`, `an`, `interesting`, `program!`]),
reduceAsync({ create: () => ``, add: (a, b) => `${a} ${b}` }),
),
)
//=> Hello World! What an interesting program!
Since
v0.0.1