MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / changeNumberUnit

Function changeNumberUnit

frontend/packages/dashboard/src/utils/dashboard.ts:68–77  ·  view source on GitHub ↗
(value?: number)

Source from the content-addressed store, hash-verified

66
67// 当数据超过10万时,保留两个小数点,单位为万,如123212,显示12.32万;
68export function changeNumberUnit(value?: number): { value: string; unit: string } {
69 if (value && value > 1000000000) {
70 return { value: (value && value / 100000000).toFixed(2), unit: '亿' }
71 } else if (value && value > 1000000) {
72 return { value: (value && value / 10000).toFixed(0), unit: '万' }
73 } else if (value && value > 10000) {
74 return { value: (value && value / 10000).toFixed(2), unit: '万' }
75 }
76 return { value: (value ?? '-') + '', unit: ' 次' }
77}
78
79export function yUnitFormatter(value: number): string {
80 let res: string = ''

Callers 2

MonitorTotalPageFunction · 0.90
MonitorPieGraphFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected