export function formatBytes(bytes: number): string { if (bytes < 1024) return `${bytes} B`; if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`; if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(0)} MB`; return `${(bytes / (1024 * 1024 * 1024)).toFixed(0)} GB`; } export function formatLimit(value: number): string { return value === -1 ? 'Unlimited' : String(value); } export function formatPrice( unitAmount: number | null, currency: string, interval: string | null ): string { if (unitAmount === null) return 'Contact us'; const amount = unitAmount / 100; const formatted = new Intl.NumberFormat('en', { style: 'currency', currency: currency.toUpperCase(), minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(amount); const intervalStr = interval === 'month' ? '/mo' : interval === 'year' ? '/yr' : ''; return `${formatted}${intervalStr}`; }