pad
pad<
T,F>(iterable,length,fill):IterableIterator<T|F>
Defined in: packages/core/src/iterable/pad.ts:16
Yields the elements, then fill as many times as needed to reach length.
An input already at or beyond length passes through unchanged — this only
ever adds, never truncates. Combine with take to get a fixed width either
way.
Time complexity: O(max(n, length)).
Type Parameters
Section titled “Type Parameters”T
F
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
length
Section titled “length”number
The width to pad up to. Must be a non-negative integer.
F
The value to pad with.
Returns
Section titled “Returns”IterableIterator<T | F>
An iterator over the elements followed by the padding.
Throws
Section titled “Throws”If length is not a non-negative integer.