MCPcopy Index your code
hub / github.com/codeaashu/claude-code / padAligned

Function padAligned

src/utils/markdown.ts:366–381  ·  view source on GitHub ↗
(
  content: string,
  displayWidth: number,
  targetWidth: number,
  align: 'left' | 'center' | 'right' | null | undefined,
)

Source from the content-addressed store, hash-verified

364 * stripAnsi'd text, so ANSI codes in `content` don't affect padding).
365 */
366export function padAligned(
367 content: string,
368 displayWidth: number,
369 targetWidth: number,
370 align: 'left' | 'center' | 'right' | null | undefined,
371): string {
372 const padding = Math.max(0, targetWidth - displayWidth)
373 if (align === 'center') {
374 const leftPad = Math.floor(padding / 2)
375 return ' '.repeat(leftPad) + content + ' '.repeat(padding - leftPad)
376 }
377 if (align === 'right') {
378 return ' '.repeat(padding) + content
379 }
380 return content + ' '.repeat(padding)
381}
382

Callers 2

renderRowLinesFunction · 0.85
formatTokenFunction · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected