From 99e24a92a1a775d5bf37d838d8259c4a16e7d3f8 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 16 Feb 2022 19:39:20 +0100 Subject: [PATCH] converted to ts --- frontend/src/scripts/test/{lazy-mode.js => lazy-mode.ts} | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) rename frontend/src/scripts/test/{lazy-mode.js => lazy-mode.ts} (81%) diff --git a/frontend/src/scripts/test/lazy-mode.js b/frontend/src/scripts/test/lazy-mode.ts similarity index 81% rename from frontend/src/scripts/test/lazy-mode.js rename to frontend/src/scripts/test/lazy-mode.ts index f6da54e81..559ae2aad 100644 --- a/frontend/src/scripts/test/lazy-mode.js +++ b/frontend/src/scripts/test/lazy-mode.ts @@ -1,4 +1,4 @@ -let accents = [ +const accents: [string, string][] = [ ["áàâäåãąą́āą̄ă", "a"], ["éèêëẽęę́ēę̄ėě", "e"], ["íìîïĩįį́īį̄", "i"], @@ -31,11 +31,14 @@ let accents = [ ["ّ", ""], ]; -export function replaceAccents(word, accentsOverride) { +export function replaceAccents( + word: string, + accentsOverride?: [accents: string, replace: string][] +): string { let newWord = word; if (!accents && !accentsOverride) return newWord; let regex; - let list = accentsOverride || accents; + const list = accentsOverride || accents; for (let i = 0; i < list.length; i++) { regex = new RegExp(`[${list[i][0]}]`, "gi"); newWord = newWord.replace(regex, list[i][1]);