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.
16 lines (11 loc) • 365 B
text/typescript
export const extractInputValue = (input: HTMLInputElement) => {
const value = input.value.toLocaleLowerCase();
if (input.selectionStart === null || input.selectionEnd === null) {
return value;
}
const index = Math.min(input.selectionStart, input.selectionEnd);
if (index > 0) {
return value.substring(index - 1, index);
}
return value;
};