Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 2x 2x 2x 2x 2x 2x 2x 2x 29x 18x 16x 2x | // src/utils/formatUtils.ts /** * Formats a numeric value in cents into a currency string (e.g., $4.99). * Handles different locales and currency symbols gracefully. * * @param amountInCents The amount in cents to format. Can be null or undefined. * @returns A formatted currency string (e.g., "$4.99"), or 'N/A' if the input is null/undefined. */ export const formatCurrency = (amountInCents: number | null | undefined): string => { if (amountInCents === null || amountInCents === undefined) return 'N/A'; return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(amountInCents / 100); }; |