MCPcopy Index your code
hub / github.com/cobusgreyling/loop-engineering / formatTokens

Function formatTokens

tools/loop-cost/src/estimator.ts:121–125  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

119}
120
121function formatTokens(n: number): string {
122 if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
123 if (n >= 1_000) return `${Math.round(n / 1_000)}k`;
124 return String(n);
125}
126
127export function estimateCost(input: EstimateInput): EstimateResult {
128 assertValidLevel(input.level);

Callers 2

estimateCostFunction · 0.85
formatEstimateHumanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected