flatMapAsync es-toolkit
Transforms each element in an array using an async function and flattens the result by one level to return a new array.
Reference
flatMapAsync(array, callback, options?)
Use flatMapAsync when performing async transformations where each element returns multiple values. It's equivalent to calling mapAsync followed by flat(), but more efficient.
Each callback function must return an array, and all returned arrays are merged into a single array. The concurrency option allows you to limit concurrent executions to manage server load.
Parameters
The array to transform.
An async function that transforms each element into an array.
Options to control concurrency.
concurrency(number, optional): Maximum number of concurrent operations. If not specified, all operations run concurrently.
Returns
A promise that resolves to an array of transformed values flattened by one level.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.