-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: add lefthand funbox for left-hand-only typing practice (@gokul1108) #7624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -564,6 +564,15 @@ const list: Partial<Record<FunboxName, FunboxFunctions>> = { | |||||||||||||||
| else return ""; | ||||||||||||||||
| }, | ||||||||||||||||
| }, | ||||||||||||||||
| lefthand: { | ||||||||||||||||
| async withWords(words?: string[]): Promise<Wordset> { | ||||||||||||||||
| const LEFT_HAND_KEYS = new Set("qwertasdfgzxcvb"); | ||||||||||||||||
| const filtered = (words ?? []).filter((w) => | ||||||||||||||||
| [...w.toLowerCase()].every((ch) => LEFT_HAND_KEYS.has(ch)), | ||||||||||||||||
| ); | ||||||||||||||||
| return new Wordset(filtered.length > 0 ? filtered : ["test"]); | ||||||||||||||||
|
||||||||||||||||
| return new Wordset(filtered.length > 0 ? filtered : ["test"]); | |
| if (filtered.length === 0) { | |
| throw new WordGenError( | |
| "No left-hand-only words available for the current word list.", | |
| ); | |
| } | |
| return new Wordset(filtered); |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No unit test covers the new lefthand.withWords filtering behavior (allowed letters + empty-result handling). Since the repo already has Vitest coverage for funbox wiring (frontend/__tests__/test/funbox.spec.ts), consider adding a small test that asserts filtering works and that the empty-match case behaves as intended.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -323,6 +323,14 @@ const list: Record<FunboxName, FunboxMetadata> = { | |||||
| frontendFunctions: ["getWord"], | ||||||
| name: "weakspot", | ||||||
| }, | ||||||
| lefthand: { | ||||||
| description: "Only words typeable with the left hand.", | ||||||
|
||||||
| description: "Only words typeable with the left hand.", | |
| description: "Only words typeable with the left hand on QWERTY.", |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lefthand is marked changesWordsFrequency, which makes it incompatible with zipf (and any other frequency-changer) via funbox compatibility checks. Since this funbox filters the word list via withWords rather than changing selection frequency, consider removing changesWordsFrequency so lefthand can still be combined with zipf/future frequency modes.
| properties: ["changesWordsFrequency"], | |
| properties: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LEFT_HAND_KEYSis recreated on everywithWordscall. Consider hoisting the allowed-chars set/regex to module scope to avoid repeated allocations during word regeneration and keep this function simpler.