filterAsync es-toolkit
Filters an array using an async predicate function and returns a new array containing only the elements that satisfy the condition.
Reference
filterAsync(array, predicate, options?)
Use filterAsync to filter an array with async operations like API calls or database queries. Unlike regular filter, it supports async predicate functions and allows you to limit concurrency with the concurrency option.
The concurrency option helps limit external API calls or manage system resources efficiently. If not specified, all operations run concurrently.
Parameters
The array to filter.
An async function that tests each element. If it returns a truthy value, the element is included in the result.
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 a new array containing only the elements for which the predicate function returned a truthy value.
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.