[**@bondsports/general**](../README.md) • **Docs**

***

[@bondsports/general](../globals.md) / parallelize

# Function: parallelize()

> **parallelize**\<`T`, `U`\>(`array`, `func`, `chunkSize`): `Promise`\<`U`[]\>

Executes the given async function in parallel for each item in the array.
Returns a promise that resolves to an array of results.

## Type Parameters

• **T** = `any`

• **U** = `any`

## Parameters

• **array**: `T`[]

The array of items to process.

• **func**

The async function to execute for each item.

• **chunkSize**: `number` = `DEFAULT_CHUNK_SIZE`

The number of items to process in each chunk (default: DEFAULT_CHUNK_SIZE).

## Returns

`Promise`\<`U`[]\>

A promise that resolves to an array of results.

## Defined in

[utils/general.util.ts:152](https://github.com/Bond-Sports/bondUtils/blob/545f16ceb055481acfd7641d7809c0f252d3a5e6/packages/general/src/utils/general.util.ts#L152)
