Skip to content

padAsync

padAsync<T, F>(iterable, length, fill): AsyncIterableIterator<T | F>

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

Yields the elements, then fill as many times as needed to reach length.

The async counterpart of pad. An input already at or beyond length passes through unchanged — this only ever adds, never truncates.

Time complexity: O(max(n, length)).

T

F

MaybeAsyncIterable<T>

The input iterable, sync or async.

number

The width to pad up to. Must be a non-negative integer.

F

The value to pad with.

AsyncIterableIterator<T | F>

An iterator over the elements followed by the padding.

If length is not a non-negative integer.