MCPcopy Create free account
hub / github.com/cortexkit/magic-context / fmt

Function fmt

packages/pi-plugin/src/status-line.ts:135–140  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

133}
134
135function fmt(n: number): string {
136 const abs = Math.abs(n);
137 if (abs >= 1_000_000) return `${trim1(n / 1_000_000)}M`;
138 if (abs >= 1_000) return `${trim1(n / 1_000)}K`;
139 return String(Math.round(n));
140}
141
142function trim1(n: number): string {
143 const rounded = n.toFixed(1);

Callers 1

renderStatusTextFunction · 0.70

Calls 1

trim1Function · 0.70

Tested by

no test coverage detected