scrabble-solver
Version:
Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Crossplay, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.
12 lines (9 loc) • 470 B
text/typescript
import { type Locale, WordDefinition } from '@scrabble-solver/types';
import { crawl } from './crawl';
import { parse } from './parse';
export const getWordDefinition = async (locale: Locale, word: string, isAllowed: boolean): Promise<WordDefinition> => {
const html = await crawl(locale, word);
const { definitions, exists } = parse(locale, html);
const wordDefinition = new WordDefinition({ definitions, exists, isAllowed, word });
return wordDefinition;
};