UNPKG

vibesweep

Version:

Detects and removes AI-generated code waste, dead code, and duplications

14 lines (11 loc) 419 B
export function formatBytes(bytes: number): string { if (bytes === 0) return '0 Bytes'; if (bytes < 0) return '0 Bytes'; const k = 1024; const sizes = ['Bytes', 'KB', 'MB', 'GB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; } export function formatPercentage(value: number): string { return `${value.toFixed(2)}%`; }