From c038275e112c56ee74fe6b6f299415a4d85137b4 Mon Sep 17 00:00:00 2001 From: kvtodev Date: Mon, 13 Jul 2026 15:49:34 +0800 Subject: [PATCH] add back moved code to git --- packages/shared/src/utils/format.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 packages/shared/src/utils/format.ts diff --git a/packages/shared/src/utils/format.ts b/packages/shared/src/utils/format.ts new file mode 100644 index 000000000..0236383c0 --- /dev/null +++ b/packages/shared/src/utils/format.ts @@ -0,0 +1,10 @@ +export function formatMudPointCount(value: number, compact = false) { + const normalizedValue = Math.max(0, Math.round(value)); + if (compact && normalizedValue >= 100_000_000) { + return `${(normalizedValue / 100_000_000).toFixed(1)}亿`; + } + if (compact && normalizedValue >= 10_000) { + return `${(normalizedValue / 10_000).toFixed(1)}万`; + } + return normalizedValue.toLocaleString('zh-CN'); +}