mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-11 14:41:17 +08:00
rewrote function to be easier to read
This commit is contained in:
parent
d0d69d2324
commit
28b510a7e2
1 changed files with 23 additions and 11 deletions
|
|
@ -864,21 +864,33 @@ export function canQuickRestart(
|
|||
mode: string,
|
||||
words: number,
|
||||
time: number,
|
||||
CustomText: MonkeyTypes.CustomText
|
||||
CustomText: MonkeyTypes.CustomText,
|
||||
customTextIsLong: boolean
|
||||
): boolean {
|
||||
const wordsLong = mode === "words" && words >= 1000;
|
||||
const timeLong = mode === "time" && time >= 900;
|
||||
const customTextLong = mode === "custom" && customTextIsLong == true;
|
||||
const customTextRandomWordsLong =
|
||||
mode === "custom" && CustomText.isWordRandom && CustomText.word >= 1000;
|
||||
const customTextRandomTimeLong =
|
||||
mode === "custom" && CustomText.isTimeRandom && CustomText.time > 900;
|
||||
const customTextNoRandomLong =
|
||||
mode === "custom" &&
|
||||
!CustomText.isWordRandom &&
|
||||
!CustomText.isTimeRandom &&
|
||||
CustomText.text.length >= 1000;
|
||||
|
||||
if (
|
||||
(mode === "words" && words < 1000) ||
|
||||
(mode === "time" && time < 3600) ||
|
||||
mode === "quote" ||
|
||||
(mode === "custom" && CustomText.isWordRandom && CustomText.word < 1000) ||
|
||||
(mode === "custom" && CustomText.isTimeRandom && CustomText.time < 3600) ||
|
||||
(mode === "custom" &&
|
||||
!CustomText.isWordRandom &&
|
||||
CustomText.text.length < 1000)
|
||||
wordsLong ||
|
||||
timeLong ||
|
||||
customTextLong ||
|
||||
customTextRandomWordsLong ||
|
||||
customTextRandomTimeLong ||
|
||||
customTextNoRandomLong
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue