Last active
June 21, 2019 10:53
-
-
Save chz/a9d7cb18ae8c2333f28c1e758545aef2 to your computer and use it in GitHub Desktop.
Ahəng qanununa uyğun şəkilçilərin əlavəsi (da,də, dakı, dəki)
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 characters
| vowelSuffix = (str, in_suffix) => { | |
| let vowel_list = 'aeiouəüöıAEIOUƏÜÖI'; | |
| let soft_vowels = ['ə', 'e', 'ö', 'ü', 'i']; | |
| let varray = []; | |
| let vowel_suffix = 'də'; | |
| let vowel_suffix_in = 'dəki'; | |
| let consonant_suffix = 'da'; | |
| let consonant_suffix_in = 'dakı'; | |
| for(let x = 0; x < str.length ; x++){ | |
| if (vowel_list.indexOf(str[x]) !== -1){ | |
| varray.push(str[x]) | |
| } | |
| } | |
| if(varray.length){ | |
| if(soft_vowels.includes(varray[varray.length - 1].toLowerCase())) { | |
| str = str + (in_suffix ? vowel_suffix_in : vowel_suffix) | |
| }else{ | |
| str = str + (in_suffix ? consonant_suffix_in : consonant_suffix) | |
| } | |
| } | |
| return str | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment