MCPcopy Create free account
hub / github.com/TanStack/ai / formatNumber

Function formatNumber

scripts/sync-provider-models.ts:414–426  ·  view source on GitHub ↗

* Format a number with underscore separators for readability. * E.g. 131072 -> '131_072', 200000 -> '200_000'

(n: number)

Source from the content-addressed store, hash-verified

412 * E.g. 131072 -> '131_072', 200000 -> '200_000'
413 */
414function formatNumber(n: number): string {
415 if (n < 1000) return String(n)
416 const str = String(n)
417 // Insert underscores every 3 digits from the right
418 const parts: Array<string> = []
419 let remaining = str
420 while (remaining.length > 3) {
421 parts.unshift(remaining.slice(-3))
422 remaining = remaining.slice(0, -3)
423 }
424 parts.unshift(remaining)
425 return parts.join('_')
426}
427
428// ---------------------------------------------------------------------------
429// File modification

Callers 1

generateModelConstantFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected