lastAsync
lastAsync<
T>(iterable,signal?):Promise<T|undefined>
Defined in: packages/core/src/iterable/async/last.ts:16
Returns the last element, or undefined when the iterable is empty.
The async counterpart of last, without its array fast path: an async source
has no length to index into, so the whole of it is drained.
Time complexity: O(n).
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 drain.
Returns
Section titled “Returns”Promise<T | undefined>
The last element, or undefined if there is none.