markEnds
markEnds<
T>(iterable):IterableIterator<MarkedEnd<T>>
Defined in: packages/core/src/iterable/mark-ends.ts:20
Yields each element tagged with whether it is the first and whether it is the last.
What every formatter needs to decide where separators, indentation or box corners go, and the reason it is worth having: knowing an element is the last one requires a one-element lookahead, so the source always runs one step ahead of what has been yielded.
A lone element is both first and last.
Time complexity: O(1) per element, allocating one tuple per yield.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
Returns
Section titled “Returns”IterableIterator<MarkedEnd<T>>
An iterator over the tagged elements.