/
concept-collection
/
benchcompress
Jump to
/
Appearance
Match my system
Paper
GitHub
Slate
Midnight
Terminal
Sign in
concept-collection
/
benchcompress
Code
Commits
Issues
0
Pull requests
0
Actions
Branches
2
Tags
0
Site
main
Branches
main
benchmark-results
benchcompress
/
web-ui
/
src
/
components
/
benchmark
/
utils
/
formatters.ts
11 lines · 320 B
Code
Blame
History
eacabc8
test real data
Jeremy Magland
1 year ago
1
export
const
formatNumber
= (
num
:
number
, decimals =
2
) => {
70a7a71
code formatting
Jeremy Magland
1 year ago
2
return
new
Intl
.
NumberFormat
(
"en-US"
, {
eacabc8
test real data
Jeremy Magland
1 year ago
3
minimumFractionDigits
: decimals,
4
maximumFractionDigits
: decimals,
5
}).
format
(num);
6
};
7
8
export
const
formatSize
= (
bytes
:
number
) => {
9
const
mb = bytes / (
1024
*
1024
);
10
return
`
${formatNumber(mb)}
MB`
;
11
};
↑
↓
move
↵
open
esc
close