chore: move abs below return check

This commit is contained in:
Sidharth Vinod
2024-07-13 22:33:54 +05:30
parent 3698c2b1e4
commit 70dcfc83e6

View File

@@ -22,10 +22,10 @@ const readStats = async (path: string): Promise<Record<string, number>> => {
};
const formatBytes = (bytes: number): string => {
bytes = Math.abs(bytes);
if (bytes == 0) {
return '0 Bytes';
}
bytes = Math.abs(bytes);
const base = 1024;
const decimals = 2;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];