firstAsync
firstAsync<
T>(iterable,signal?):Promise<T|undefined>
Defined in: packages/core/src/iterable/async/first.ts:16
Returns the first element, or undefined when the iterable is empty.
The async counterpart of first. T cannot itself include undefined, so
the absent case is never ambiguous.
Time complexity: O(1). The iterator is closed without being drained.
Type Parameters
Section titled “Type Parameters”T extends DefinedValue
Parameters
Section titled “Parameters”iterable
Section titled “iterable”The iterable to read from, sync or async.
signal?
Section titled “signal?”AbortSignal
Aborts the read.
Returns
Section titled “Returns”Promise<T | undefined>
The first element, or undefined if there is none.