canina/frontend/application/lib/utils/utils.ts

9 lines
315 B
TypeScript

export const toPersian = (n: number | string | undefined | null) => {
if (n === undefined || n === null) return "";
return n.toString().replace(/\d/g, d => '۰۱۲۳۴۵۶۷۸۹'[parseInt(d)]);
};
export function cn(...classes: (string | boolean | undefined)[]) {
return classes.filter(Boolean).join(" ");
}