import DineroFactory, { Currency } from "dinero.js";
import { MoneyDTO } from "../../../common";

export const formatMoney = (value: MoneyDTO) => {
  const money = DineroFactory({
    amount: Number(value.value),
    currency: value.currency_code as Currency,
    precision: Number(value.scale),
  });

  return money.toFormat();
};
