const PersianNumber = ({ number, isCost, size, bold, style }) => {
  if (number || number === 0) {
    const persianMap = "۰۱۲۳۴۵۶۷۸۹".split("");
    const formatNumber = isCost
      ? number.toLocaleString().replace(/\d/g, (m) => persianMap[parseInt(m)])
      : number.toString().replace(/\d/g, (m) => persianMap[parseInt(m)]);
    return (
      <span
        className={`text-[${size ? size : ""}px]  ${
          bold ? "font-bold" : ""
        }  text-sm ${style}`}
      >
        {formatNumber}
      </span>
    );
  } else return null;
};

export default PersianNumber;
