Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function findWord(word) {
const allWords = loadWords();
return Object.assign(
{},
...Object.entries(allWords)
.map(([name, words]) => {
const foundIndex = words.findIndex(w => w.toLowerCase() === word.toLowerCase());
return foundIndex >= 0 ? { [name]: foundIndex + 1 } : {};
}),
);
}
function getWordsList(language, count) {
const words = loadWords();
return words[language].slice(0, count);
}