Skip to main content

Function: lastAsync()

lastAsync<Value>(asyncIterable): AsyncIterable<Value, any, any>

Returns an async iterable containing the last value of asyncIterable, or an empty async iterable if asyncIterable is empty.

Type Parameters

Value

Parameters

asyncIterable: AsyncIterable<Value, any, any>

Returns

AsyncIterable<Value, any, any>

Example

console.log(
await pipe(
asAsync([`sloth`, `more sloth`, `even more sloth`]),
lastAsync,
reduceAsync(toArray()),
),
)
//=> [ 'even more sloth' ]

Defined in

splices.d.ts:452