Skip to content

alwaysIterableAsync

alwaysIterableAsync<T>(value): AsyncIterableIterator<T>

Defined in: packages/core/src/iterable/async/always-iterable.ts:17

Normalises “one item or many” into an async iterable, at a boundary where a caller may pass either.

The async counterpart of alwaysIterable, and it keeps the rule that matters: a string is treated as a single item, never as a sequence of characters.

Time complexity: O(1).

T

T | MaybeAsyncIterable<T>

A single item, or an iterable of them, sync or async.

AsyncIterableIterator<T>

An async iterable over value’s elements when it is a non-string iterable, otherwise over value alone.