mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-27 02:21:27 +08:00
use safe number
This commit is contained in:
parent
af52ad810b
commit
4874a72a89
1 changed files with 2 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { roundTo2 } from "@monkeytype/util/numbers";
|
||||
import { roundTo2, safeNumber } from "@monkeytype/util/numbers";
|
||||
import * as TestStats from "./test-stats";
|
||||
|
||||
type KeydownEvent = {
|
||||
|
|
@ -356,7 +356,7 @@ export function getMissedWords(): Record<string, number> {
|
|||
if (event.mode !== "insert") return acc;
|
||||
if (!event.correct) {
|
||||
const word = event.targetWord;
|
||||
acc[word] = (acc[word] || 0) + 1;
|
||||
acc[word] = (safeNumber(acc[word]) ?? 0) + 1;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue