MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / wrapAt

Function wrapAt

src/diagnostics/token-analyzer.ts:379–394  ·  view source on GitHub ↗
(s: string, width: number)

Source from the content-addressed store, hash-verified

377}
378
379function wrapAt(s: string, width: number): string {
380 const words = s.split(' ');
381 const lines: string[] = [];
382 let cur = '';
383 for (const w of words) {
384 if (cur.length === 0) { cur = w; continue; }
385 if (cur.length + 1 + w.length > width) {
386 lines.push(cur);
387 cur = w;
388 } else {
389 cur += ' ' + w;
390 }
391 }
392 if (cur) lines.push(cur);
393 return lines.join('\n');
394}

Callers 1

formatReportFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected