UNPKG

@scrabble-solver/solver

Version:
17 lines (16 loc) 573 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const areDigraphsValid = (config, pattern) => { const { twoCharacterTiles } = config; const { cells } = pattern; for (let index = 0; index < cells.length - 1; ++index) { const current = cells[index]; const next = cells[index + 1]; const digraphCandidate = current.tile.character + next.tile.character; if (twoCharacterTiles.includes(digraphCandidate)) { return false; } } return true; }; exports.default = areDigraphsValid;