converting to lowercase if punctuation is disabled instead of regenerating

This commit is contained in:
Miodec 2022-09-08 14:10:14 +02:00
parent e9c6534c39
commit d1fbc21c1e

View file

@ -807,10 +807,7 @@ async function getNextWord(
let regenarationCount = 0; //infinite loop emergency stop button
while (
regenarationCount < 100 &&
((Config.mode !== "custom" &&
/[A-Z]/.test(randomWord) &&
!Config.punctuation) ||
previousWord == randomWord ||
(previousWord == randomWord ||
previousWord2 == randomWord ||
(Config.mode !== "custom" &&
!Config.punctuation &&
@ -827,6 +824,14 @@ async function getNextWord(
}
}
if (
Config.mode !== "custom" &&
/[A-Z]/.test(randomWord) &&
!Config.punctuation
) {
randomWord = randomWord.toLowerCase();
}
if (randomWord === undefined) {
randomWord = wordset.randomWord();
}