/* eslint-disable implicit-arrow-linebreak */
export function parser(value?: string) {
  if (!value) return 0;

  const normalized = value.replace(/\s/g, '').replaceAll(',', '.');

  return Number.parseFloat(normalized);
}
export const formatter = (value?: number) =>
  Intl.NumberFormat('ru', {
    minimumFractionDigits: 2,
  }).format(value || 0);

export const formatterExtra = (value?: number) =>
  Intl.NumberFormat('ru', {
    minimumFractionDigits: 2,
    maximumFractionDigits: 6,
  }).format(value || 0);
