This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include https://github.com/mahmoud-eskandari/NumToPersian | |
get_persian(val) { | |
// return "صفر تومان" if val is 0 | |
if(Number(val) === 0) return 'صفر تومان'; | |
// check value for change separated value to number | |
let non_separated_val = isNaN(val) ? Number(val.split(',').join('')) :val; | |
// get "toman" part if number is bigger than 9 rial | |
let toman_part = non_separated_val > 9 ? Num2persian(Math.floor(non_separated_val / 10)) + ' تومان ' : ''; |