src/digits.js
/**
* Convert Persian digits to English digits. 
*/
Convert Persian digits to English digits.
Convert Persian digits to English digits .
function toEnglishDigits(str) {
    str = String(str);
    let e = '۰'.charCodeAt(0);
    str = str.replace(/[۰-۹]/g, function (t) {
        return t.charCodeAt(0) - e;
    });
    e = '٠'.charCodeAt(0);
    str = str.replace(/[٠-٩]/g, function (t) {
        return t.charCodeAt(0) - e;
    });
    return str;
}
function toEnglishDigits ( str ) { str = String ( str ) ; let e = '۰'. c harCodeAt( 0 ) ; str = str . replace ( / [۰-۹]/g , f nction ( ) { return t . charCodeAt ( 0 ) - e ; } ) ; e = '٠'. c harCodeAt( 0 ) ; str = str . replace ( / [٠-٩]/g , f nction ( ) { return t . charCodeAt ( 0 ) - e ; } ) ; return str ; }
Convert Persian digits to English digits.
Convert Persian digits to English digits .