MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / paddedForEach

Function paddedForEach

packages/logger/src/log.ts:80–94  ·  view source on GitHub ↗
(
    list: readonly T[],
    getPaddedValue: (item: T, index: number) => I,
    callback: (paddedValue: I, item: T, index: number) => void,
)

Source from the content-addressed store, hash-verified

78}
79
80export 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
96export const getComputationCreatedLabel = (
97 type: string,

Callers 3

debugPropsFunction · 0.90
logOwnersDiffFunction · 0.85
logOwnerListFunction · 0.85

Calls 1

createAlignedTextWidthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…