7 lines
250 B
TypeScript

export function parser(value?: string) {
const normalized = (value || '0').replace(/\s/g, '').replaceAll(',', '.');
return Number.parseFloat(normalized);
}
export const formatter = (value?: number) => Intl.NumberFormat('ru').format(value || 0);