/** * Wraps a value in a {@link Promise}. */ declare function promise(value: T): Promise>; /** * A function that returns a {@link Promise} of type T. */ type AsyncFn = () => Promise; /** * Executes asynchronous tasks with a concurrency limit. * * @example * ```ts * const items = [1, 2, 3, 4, 5] * const results = await concurrent(items.map(item => async () => { * // Simulate an asynchronous operation * await new Promise(resolve => setTimeout(resolve, 1000)) * return item * 2 * }), 2) * * console.log(results) // [2, 4, 6, 8, 10] * ``` */ declare function concurrent(tasks: AsyncFn[], limit: number): Promise; /** * Split an array into chunks, then await all promises in each chunk before proceeding to the next. */ declare function batch(array: T[], batchSize: number, callback: (item: T) => Promise): Promise; export { batch, concurrent, promise }; export type { AsyncFn };