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

Function truncate

src/utils/ui-limits.ts:31–38  ·  view source on GitHub ↗
(s: string | null)

Source from the content-addressed store, hash-verified

29
30 // Truncate each side to UI_MAX_DIFF_BYTES, with a marker
31 const truncate = (s: string | null): string | null => {
32 if (s === null) return null;
33 if (s.length <= UI_MAX_DIFF_BYTES) return s;
34 const half = Math.floor(UI_MAX_DIFF_BYTES / 2);
35 return s.slice(0, half) +
36 `\n\n... [${(s.length - UI_MAX_DIFF_BYTES).toLocaleString()} bytes elided for display — full content will be written] ...\n\n` +
37 s.slice(-half);
38 };
39
40 return {
41 path,

Callers 1

prepareDiffPreviewFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected