register address

This commit is contained in:
Samandar Turgunboyev
2026-03-26 14:23:58 +05:00
parent fee9213c59
commit a671706fb3
12 changed files with 555 additions and 311 deletions

View File

@@ -16,8 +16,7 @@ const latinToCyrillicMap = [
["'", ""] // apostrofni olib tashlaymiz
];
export function formatText(str: string | null) {
if (!str) return null;
export function formatText(str: string) {
let result = str;
for (let [latin, cyrillic] of latinToCyrillicMap) {
const regex = new RegExp(latin, "g");
@@ -32,6 +31,7 @@ const cyrillicToLatinMap = [
["Ш", "Sh"], ["ш", "sh"],
["Ч", "Ch"], ["ч", "ch"],
["ё", "yo"], ["Ё", "YO"],
["Я", "Ya"], ["я", "ya"],
["А", "A"], ["Б", "B"], ["Д", "D"], ["Е", "E"], ["Ф", "F"],
["Г", "G"], ["Ҳ", "H"], ["И", "I"], ["Ж", "J"], ["К", "K"],
["Л", "L"], ["М", "M"], ["Н", "N"], ["О", "O"], ["П", "P"],
@@ -44,8 +44,7 @@ const cyrillicToLatinMap = [
["в", "v"], ["х", "x"], ["й", "y"], ["з", "z"],
];
export function formatTextToLatin(str: string | null) {
if (!str) return null;
export function formatTextToLatin(str: string) {
let result = str;
for (let [cyrillic, latin] of cyrillicToLatinMap) {
const regex = new RegExp(cyrillic, "g");