mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-21 12:51:17 -05:00
Format large numbers to use k or m
This commit is contained in:
12
webview-ui/src/utils/format.ts
Normal file
12
webview-ui/src/utils/format.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export function formatLargeNumber(num: number): string {
|
||||
if (num >= 1e9) {
|
||||
return (num / 1e9).toFixed(1) + "b"
|
||||
}
|
||||
if (num >= 1e6) {
|
||||
return (num / 1e6).toFixed(1) + "m"
|
||||
}
|
||||
if (num >= 1e3) {
|
||||
return (num / 1e3).toFixed(1) + "k"
|
||||
}
|
||||
return num.toString()
|
||||
}
|
||||
Reference in New Issue
Block a user