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.

19 lines (16 loc) 686 B
import { Locale } from '@scrabble-solver/types'; import { transliterate } from 'transliteration'; const transliteratePerLocale: Record<Locale, (word: string) => string> = { [Locale.DE_DE]: (word) => word, [Locale.EN_GB]: (word) => word, [Locale.EN_US]: (word) => word, [Locale.ES_ES]: (word) => transliterate(word, { ignore: ['ñ', 'Ñ'] }), [Locale.FA_IR]: (word) => word, [Locale.FR_FR]: (word) => transliterate(word), [Locale.PL_PL]: (word) => word, [Locale.RO_RO]: (word) => transliterate(word), [Locale.TR_TR]: (word) => word, }; export const localeTransliterate = (locale: Locale, value: string): string => { return transliteratePerLocale[locale](value); };