This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add once near the top | |
| const normalizeLocaleArtifacts = (s: string) => | |
| s | |
| // normalize various non-breaking / narrow spaces to regular space | |
| .replace(/\u00A0|\u202F/g, ' ') | |
| // normalize typographic apostrophe ’ to ASCII ' | |
| .replace(/\u2019/g, "'"); | |
| export function formatMoney(value: number | string, format: string = 'amount', options: { symbol?: string; position?: string } = {}): string { | |
| if (typeof format === 'string') format = format.trim().toLowerCase(); |