UNPKG

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.

26 lines (25 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parse = void 0; const types_1 = require("@scrabble-solver/types"); const languages_1 = require("./languages"); const lib_1 = require("./lib"); const parsePerLocale = { [types_1.Locale.DE_DE]: languages_1.german.parse, [types_1.Locale.EN_GB]: languages_1.english.parse, [types_1.Locale.EN_US]: languages_1.english.parse, [types_1.Locale.ES_ES]: languages_1.spanish.parse, [types_1.Locale.FA_IR]: languages_1.persian.parse, [types_1.Locale.FR_FR]: languages_1.french.parse, [types_1.Locale.PL_PL]: languages_1.polish.parse, [types_1.Locale.RO_RO]: languages_1.romanian.parse, [types_1.Locale.TR_TR]: languages_1.turkish.parse, }; const parse = (locale, html) => { const { definitions, exists } = parsePerLocale[locale](html); return { definitions: (0, lib_1.unique)(definitions.map(lib_1.normalizeDefinition).filter(Boolean)), exists, }; }; exports.parse = parse;