22 lines
558 B
TypeScript
Raw Normal View History

import { CurriedFunction3 } from 'lodash';
export type MapAsync<T = any, R = any> = CurriedFunction3<
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-01-31 15:14:26 +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
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>
>;