Skip to content

Commit 4733334

Browse files
authored
Update shared.ts
Updates the logic for getting a random word and checking the existence of the input
1 parent cf74d4e commit 4733334

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/shared.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Theme, toast } from "react-toastify";
22

3-
import words from "./words";
3+
import game_words from "./game_words";
4+
import dictionary from "./existing_words";
45

56
export const getRandomWord = () =>
6-
words[Math.floor(Math.random() * words.length)];
7+
game_words[Math.floor(Math.random() * game_words.length)];
78

89
export const testGuess = (guess: string, word: string) => {
910
const types: string[] = [];
@@ -21,7 +22,7 @@ export const testGuess = (guess: string, word: string) => {
2122
};
2223

2324
export const isValid = (guess: string) => {
24-
return words.findIndex((item) => guess.toLowerCase() === item) !== -1;
25+
return dictionary.findIndex((item) => guess.toLowerCase() === item) !== -1;
2526
};
2627

2728
export const customToast = (value: string, autoClose: number | false = 500) => {

0 commit comments

Comments
 (0)