Skip to main content

Variable: lastAsync()

const lastAsync: <Value>(asyncIterable) => AsyncOptional<Value>

Defined in: splices.d.ts:469

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

Type Parameters

Value

Value

Parameters

asyncIterable

AsyncIterable<Value>

Returns

AsyncOptional<Value>

Example

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

Since

v0.0.1