From f6f16b1dc677b3536dacfdf7e04fda0b9236605c Mon Sep 17 00:00:00 2001 From: Jacob Louis Hoover Date: Wed, 26 Jan 2022 18:08:22 -0500 Subject: [PATCH] Loop solutions Loop the index, to avoid out of range error if the list is exhausted (quite easy to do if the wordlist is modified, as might be what's going on in https://github.com/hannahcode/wordle/issues/63) --- src/lib/words.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/words.ts b/src/lib/words.ts index 140f0c9..cabfed6 100644 --- a/src/lib/words.ts +++ b/src/lib/words.ts @@ -21,7 +21,7 @@ export const getWordOfDay = () => { const nextday = (index + 1) * msInDay + epochMs return { - solution: WORDS[index].toUpperCase(), + solution: WORDS[index % WORDS.length].toUpperCase() solutionIndex: index, tomorrow: nextday, }