export function formatCurrency( value: number, currency: { symbol: string; currency_position: 'left' | 'right' | 'leftspace' | 'rightspace'; thousand_separator: string; decimal_separator: string; decimal_number: number; }, wallet: boolean = false ): string { const parts = value.toFixed(currency.decimal_number).split('.'); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, currency.thousand_separator); const formatted = parts.join(currency.decimal_separator); if (wallet) { return formatted; } switch (currency.currency_position) { case 'left': return currency.symbol + formatted; case 'right': return formatted + currency.symbol; case 'leftspace': return `${currency.symbol} ${formatted}`; case 'rightspace': return `${formatted} ${currency.symbol}`; default: return formatted; } }