MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / formatNumber

Function formatNumber

src/utils/format.ts:124–131  ·  view source on GitHub ↗
(number: number)

Source from the content-addressed store, hash-verified

122}
123
124export function formatNumber(number: number): string {
125 // Only use minimumFractionDigits for numbers that will be shown in compact notation
126 const shouldUseConsistentDecimals = number >= 1000
127
128 return getNumberFormatter(shouldUseConsistentDecimals)
129 .format(number) // eg. "1321" => "1.3K", "900" => "900"
130 .toLowerCase() // eg. "1.3K" => "1.3k", "1.0K" => "1.0k"
131}
132
133export function formatTokens(count: number): string {
134 return formatNumber(count).replace('.0', '')

Callers 15

format.test.tsFile · 0.90
renderToolResultMessageFunction · 0.85
renderToolResultMessageFunction · 0.85
formatModelUsageFunction · 0.85
AgentLineFunction · 0.85
OverviewTabFunction · 0.85
ModelEntryFunction · 0.85
renderOverviewToAnsiFunction · 0.85
renderModelsToAnsiFunction · 0.85
AgentProgressLineFunction · 0.85
SpinnerWithVerbInnerFunction · 0.85

Calls 1

getNumberFormatterFunction · 0.85

Tested by

no test coverage detected