19 lines
468 B
JavaScript
19 lines
468 B
JavaScript
const t = (n) => {
|
||
if (!(n == null || n === ""))
|
||
return String(n).replace(/\d/g, (r) => "۰۱۲۳۴۵۶۷۸۹"[Number(r)]);
|
||
}, e = (n) => {
|
||
if (!(n == null || n === ""))
|
||
return String(n).replace(
|
||
/[۰-۹]/g,
|
||
(r) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(r))
|
||
);
|
||
}, i = (n) => {
|
||
if (!(n == null || n === ""))
|
||
return new Intl.NumberFormat("fa-IR").format(Number(n));
|
||
};
|
||
export {
|
||
e as toEnDigits,
|
||
t as toFaDigits,
|
||
i as toFaNumber
|
||
};
|