2023-02-13 11:33:03 +01:00
|
|
|
import { CurriedFunction3 } from 'lodash';
|
|
|
|
|
|
|
|
export type MapAsync<T = any, R = any> = CurriedFunction3<
|
2023-02-01 15:56:39 +01:00
|
|
|
T[],
|
|
|
|
(element: T, index: number) => R | Promise<R>,
|
|
|
|
{ concurrency?: number },
|
|
|
|
Promise<R[]>
|
|
|
|
>;
|
2023-02-06 15:59:47 +01:00
|
|
|
|
|
|
|
export type ForEachAsync<T = any, R = any> = (
|
2023-02-13 11:40:51 +01:00
|
|
|
array: T[],
|
|
|
|
func: (element: T, index: number) => R | Promise<R>,
|
|
|
|
options?: { concurrency?: number }
|
2023-02-06 15:59:47 +01:00
|
|
|
) => Promise<R[]>;
|
2023-01-31 15:14:26 +01:00
|
|
|
|
2023-02-13 11:33:03 +01:00
|
|
|
export type ReduceAsync<T = any, V = T, R = V> = CurriedFunction3<
|
2023-01-31 15:14:26 +01:00
|
|
|
T[],
|
|
|
|
(accumulator: V | R, current: Awaited<T>, index: number) => R | Promise<R>,
|
|
|
|
V,
|
|
|
|
Promise<R>
|
|
|
|
>;
|