MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / truncate

Function truncate

src/context/formatter.ts:272–277  ·  view source on GitHub ↗

* Truncate a string with ellipsis

(str: string, maxLength: number)

Source from the content-addressed store, hash-verified

270 * Truncate a string with ellipsis
271 */
272function truncate(str: string, maxLength: number): string {
273 if (str.length <= maxLength) {
274 return str;
275 }
276 return str.slice(0, maxLength - 3) + '...';
277}
278
279/**
280 * Format bytes as human-readable string

Callers 2

formatNodeTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected