MCPcopy Create free account
hub / github.com/brillout/react-streaming / pad

Function pad

src/utils/debug.ts:75–89  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

73}
74
75function pad(str: string): string {
76 const PADDING = ' '
77 const terminalWidth = getTerminalWidth()
78 const lines: string[] = []
79 str.split('\n').forEach((line) => {
80 if (!terminalWidth) {
81 lines.push(line)
82 } else {
83 chunk(line, terminalWidth - PADDING.length).forEach((chunk) => {
84 lines.push(chunk)
85 })
86 }
87 })
88 return lines.join('\n' + PADDING)
89}
90function chunk(str: string, size: number): string[] {
91 if (str.length <= size) {
92 return [str]

Callers 1

strInfoFunction · 0.85

Calls 2

getTerminalWidthFunction · 0.85
chunkFunction · 0.85

Tested by

no test coverage detected