mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-27 16:24:41 +08:00
refactor: funbox compatibility checks
refactored the speak checks to make sure many "unspeakable" funboxes can be used at once unspeakable funboxes are only blocked when "speaks" funbox is enabled
This commit is contained in:
parent
0ccf7ea920
commit
244a593fa5
1 changed files with 11 additions and 7 deletions
|
@ -265,13 +265,17 @@ export function areFunboxesCompatible(
|
|||
funboxesToCheck.filter((f) =>
|
||||
f.properties?.find((fp) => fp === "symmetricChars")
|
||||
).length === 0;
|
||||
const canSpeak =
|
||||
funboxesToCheck.filter((f) =>
|
||||
f.properties?.find((fp) => fp === "speaks" || fp === "unspeakable")
|
||||
).length <= 1;
|
||||
const hasLanguageToSpeak =
|
||||
const oneCanSpeakMax =
|
||||
funboxesToCheck.filter((f) => f.properties?.find((fp) => fp === "speaks"))
|
||||
.length <= 1;
|
||||
const hasLanguageToSpeakAndNoUnspeakable =
|
||||
funboxesToCheck.filter((f) => f.properties?.find((fp) => fp === "speaks"))
|
||||
.length === 0 ||
|
||||
(funboxesToCheck.filter((f) => f.properties?.find((fp) => fp === "speaks"))
|
||||
.length === 1 &&
|
||||
funboxesToCheck.filter((f) =>
|
||||
f.properties?.find((fp) => fp === "unspeakable")
|
||||
).length === 0) ||
|
||||
funboxesToCheck.filter((f) =>
|
||||
f.properties?.find((fp) => fp === "ignoresLanguage")
|
||||
).length === 0;
|
||||
|
@ -318,8 +322,8 @@ export function areFunboxesCompatible(
|
|||
noFrequencyChangesConflicts &&
|
||||
capitalisationChangePosibility &&
|
||||
noConflictsWithSymmetricChars &&
|
||||
canSpeak &&
|
||||
hasLanguageToSpeak &&
|
||||
oneCanSpeakMax &&
|
||||
hasLanguageToSpeakAndNoUnspeakable &&
|
||||
oneToPushOrPullSectionMax &&
|
||||
oneApplyCSSMax &&
|
||||
onePunctuateWordMax &&
|
||||
|
|
Loading…
Reference in a new issue