UNPKG

scrabble-solver

Version:

Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.

20 lines (15 loc) 512 B
import { BoardJson, Locale, Result, 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); };