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.
20 lines (15 loc) • 527 B
text/typescript
import { type BoardJson, type Locale, Result, type ResultJson } from '@scrabble-solver/types';
import { fetchJson } from './fetchJson';
interface Payload {
board: BoardJson;
characters: string[];
game: string;
locale: Locale;
}
export const solve = async ({ board, characters, game, locale }: Payload): Promise<Result[]> => {
const json = await fetchJson<ResultJson[]>('/api/solve', {
method: 'POST',
body: JSON.stringify({ board, characters, game, locale }),
});
return json.map(Result.fromJson);
};