filterMapAsync
filterMapAsync<
T,R>(iterable,mapper):AsyncIterableIterator<R>
Defined in: packages/core/src/iterable/async/filter-map.ts:20
Maps and filters in one pass: yields every mapped value except the ones the mapper declines to produce.
The async counterpart of filterMap. undefined is the decline signal, and
the result type cannot include it, so “no value here” is never confused with
“the value is undefined”.
Time complexity: O(1) per element, plus whatever mapper costs.
Type Parameters
Section titled “Type Parameters”T
R extends DefinedValue
Parameters
Section titled “Parameters”iterable
Section titled “iterable”The input iterable, sync or async.
mapper
Section titled “mapper”MaybeAsyncCallable<[T, number], R | undefined>
Receives each element and its zero-based index. Resolves to the
mapped value, or undefined to drop the element.
Returns
Section titled “Returns”AsyncIterableIterator<R>
An iterator over the produced values.