MCPcopy Index your code
hub / github.com/getagentseal/codeburn / formatCost

Function formatCost

gnome/indicator.js:79–87  ·  view source on GitHub ↗
(value, currency, rate = 1, exact = false)

Source from the content-addressed store, hash-verified

77};
78
79function formatCost(value, currency, rate = 1, exact = false) {
80 const n = (Number(value) || 0) * (Number(rate) || 1);
81 const abs = Math.abs(n);
82 const symbol = currency?.symbol || '$';
83 if (!exact && abs >= 1000) return `${symbol}${(n / 1000).toFixed(abs >= 10000 ? 0 : 1)}k`;
84 const parts = n.toFixed(2).split('.');
85 parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
86 return `${symbol}${parts.join('.')}`;
87}
88
89function formatTokensCompact(n) {
90 const v = Number(n) || 0;

Callers 15

renderAuditTableFunction · 0.90
planStatusTextFunction · 0.90
OverviewFunction · 0.90
DailyActivityFunction · 0.90
ProjectBreakdownFunction · 0.90
ModelBreakdownFunction · 0.90
ActivityBreakdownFunction · 0.90
SkillsAndAgentsFunction · 0.90
ClaudeAgentTypesFunction · 0.90
FindingPanelFunction · 0.90
OptimizeViewFunction · 0.90
formatValueFunction · 0.90

Calls

no outgoing calls

Tested by 1

avgCostLabelFunction · 0.72