Last active
December 26, 2016 19:24
-
-
Save masoudgs/a794fdfc0359831dc5a06c9558ce1eea to your computer and use it in GitHub Desktop.
Revisions
-
Masoud Ghorbani renamed this gist
Dec 26, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ function toFarsiDigit(number) { } function toEnglishDigit(number) { const regex = /[\u0660-\u0669\u06F0-\u06F9]/g let result = number.replace(regex, function (w) { return String.fromCharCode(w.charCodeAt(0) - 1728) }) -
mcrunix revised this gist
Dec 8, 2016 . 2 changed files with 20 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ function toFarsiDigit(number) { const regex = /[0-9]/g let result = number.replace(regex, function (w) { return String.fromCharCode(w.charCodeAt(0) + 1728) }) return result } function toEnglishDigit(number) { const regex = /[۰−۹]/g let result = number.replace(regex, function (w) { return String.fromCharCode(w.charCodeAt(0) - 1728) }) return result } exports.toEnglishDigit = toEnglishDigit exports.toFarsiDigit = toFarsiDigit -
mcrunix created this gist
Dec 8, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ function toFarsiDigit(number) { const regex = /[0-9]/g let result = number.replace(regex, function (w) { return String.fromCharCode(w.charCodeAt(0) + 1728) }) return result } exports.toFarsiDigit = toFarsiDigit