/ concept-collection / benchcompress
Sign in
concept-collection / benchcompress
benchcompress / web-ui / src / components / benchmark / utils / formatters.ts
11 lines · 320 BCodeBlameHistory
eacabc8test real dataJeremy Magland 1export const formatNumber = (num: number, decimals = 2) => {
70a7a71code formattingJeremy Magland 2 return new Intl.NumberFormat("en-US", {
eacabc8test real dataJeremy Magland 3 minimumFractionDigits: decimals,
4 maximumFractionDigits: decimals,
5 }).format(num);
6};
8export const formatSize = (bytes: number) => {
9 const mb = bytes / (1024 * 1024);
10 return `${formatNumber(mb)} MB`;
11};
moveopenescclose