(
list: readonly T[],
getPaddedValue: (item: T, index: number) => I,
callback: (paddedValue: I, item: T, index: number) => void,
)
| 78 | } |
| 79 | |
| 80 | export function paddedForEach<T, I extends string>( |
| 81 | list: readonly T[], |
| 82 | getPaddedValue: (item: T, index: number) => I, |
| 83 | callback: (paddedValue: I, item: T, index: number) => void, |
| 84 | ): void { |
| 85 | const [getPaddedText, updateWidth] = createAlignedTextWidth<I>() |
| 86 | const mapped: [T, I][] = list.map((item, index) => { |
| 87 | const paddedValue = getPaddedValue(item, index) |
| 88 | updateWidth(paddedValue) |
| 89 | return [item, paddedValue] |
| 90 | }) |
| 91 | mapped.forEach(([item, paddedValue], index) => |
| 92 | callback(getPaddedText(paddedValue), item, index), |
| 93 | ) |
| 94 | } |
| 95 | |
| 96 | export const getComputationCreatedLabel = ( |
| 97 | type: string, |
no test coverage detected
searching dependent graphs…