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.

13 lines (10 loc) 545 B
const TWO_TILE_CHARACTER_LENGTH = 2; const MAX_CHARACTER_LENGTH = TWO_TILE_CHARACTER_LENGTH; export const isCharacterValid = (character: string): boolean => { /* * We could be strict here and check whether config.hasCharacter(character) || character === BLANK * but since this case won't really affect/break solving, we don't need to worry about it. * It's better to display an empty state than error state in UI, so this is a sanity check only. */ return character.length !== 0 && character.length <= MAX_CHARACTER_LENGTH; };