MCPcopy Create free account
hub / github.com/astercloud/aster / formatNumber

Function formatNumber

studio/src/lib/utils.ts:10–18  ·  view source on GitHub ↗
(num: number, decimals: number = 0)

Source from the content-addressed store, hash-verified

8
9// Format numbers
10export function formatNumber(num: number, decimals: number = 0): string {
11 if (num >= 1_000_000) {
12 return (num / 1_000_000).toFixed(decimals) + 'M';
13 }
14 if (num >= 1_000) {
15 return (num / 1_000).toFixed(decimals) + 'K';
16 }
17 return num.toFixed(decimals);
18}
19
20// Format currency
21export function formatCurrency(amount: number, currency: string = 'USD'): string {

Callers 6

SessionsFunction · 0.90
SessionDetailFunction · 0.90
MetricsFunction · 0.90
TracesFunction · 0.90
OverviewFunction · 0.90
TraceDetailFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected