export const digitToPersian = (digit) => { let enNums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] let faNums = ['۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹', '۰'] let digitString = digit + ''; let digitArray = digitString.split(''); for (let i in digitArray) { if (enNums.includes(digitArray[i])) digitArray[i] = faNums[enNums.indexOf(digitArray[i])] } return digitArray.join('') } export const digitToEn = (digit) => { let enNums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] let faNums = ['۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹', '۰'] let digitString = digit + ''; let digitArray = digitString.split(''); for (let i in digitArray) { if (faNums.includes(digitArray[i])) digitArray[i] = enNums[faNums.indexOf(digitArray[i])] } return digitArray.join('') } export const waitToFinish = async (setLoading, func) => { setLoading(true); await func(); setLoading(false) }