const formatCurrency = (price: number, currency: string): string => {
  try {
    return new Intl.NumberFormat(undefined, {
      style: 'currency',
      currency,
    }).format(price);
  } catch (e) {
    return `${price} ${currency}`;
  }
};

export default formatCurrency;
