MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / formatLargeNumber

Function formatLargeNumber

webview-ui/src/utils/format.ts:3–14  ·  view source on GitHub ↗
(num: number)

Source from the content-addressed store, hash-verified

1import i18next from "i18next"
2
3export function formatLargeNumber(num: number): string {
4 if (num >= 1e9) {
5 return (num / 1e9).toFixed(1) + i18next.t("common:number_format.billion_suffix")
6 }
7 if (num >= 1e6) {
8 return (num / 1e6).toFixed(1) + i18next.t("common:number_format.million_suffix")
9 }
10 if (num >= 1e3) {
11 return (num / 1e3).toFixed(1) + i18next.t("common:number_format.thousand_suffix")
12 }
13 return num.toString()
14}
15
16export const formatDate = (timestamp: number) => {
17 const date = new Date(timestamp)

Callers 3

TaskHeaderFunction · 0.90
ContextWindowProgressFunction · 0.90
format.spec.tsFile · 0.90

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected