UNPKG

num-to-arabic

Version:
13 lines (11 loc) 291 B
//Convert numbers function convertToArabic(number: number | string): string { return number .toString() .replace( /\d/g, (x: string | number) => ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"][x as number] ); } export default convertToArabic;