MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / formatChange

Function formatChange

src/lib/format.ts:12–23  ·  view source on GitHub ↗
(delta: number | null)

Source from the content-addressed store, hash-verified

10}
11
12export function formatChange(delta: number | null): {
13 text: string;
14 cls: "up" | "down" | "neutral";
15} {
16 if (delta === null || delta === undefined || isNaN(delta))
17 return { text: "—", cls: "neutral" };
18 const sign = delta >= 0 ? "+" : "";
19 return {
20 text: `${sign}${(delta * 100).toFixed(1)}%`,
21 cls: delta > 0.001 ? "up" : delta < -0.001 ? "down" : "neutral",
22 };
23}

Callers 4

ToastContainerFunction · 0.90
MarketPreviewFunction · 0.90
MarketDetailPanelInnerFunction · 0.90
MarketCardInnerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected