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.

18 lines (13 loc) 464 B
import { findFirstWordIndex } from './findFirstWordIndex'; export const extractWords = (file: string, locale: string): string[] => { const lines = file.split(/\r?\n/g); const firstWordIndex = findFirstWordIndex(lines, locale); const words: string[] = []; for (let i = firstWordIndex; i < lines.length; ++i) { const trimmed = lines[i].trim(); if (trimmed.length > 0) { words.push(trimmed.toLocaleLowerCase()); } } return words; };