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.

20 lines (14 loc) 463 B
import { type Pattern } from '@scrabble-solver/types'; import { getPatternHash } from './getPatternHash'; export const getUniquePatterns = (patterns: Pattern[]): Pattern[] => { const hashes = new Set<string>(); const uniquePatterns: Pattern[] = []; for (const pattern of patterns) { const hash = getPatternHash(pattern); if (!hashes.has(hash)) { hashes.add(hash); uniquePatterns.push(pattern); } } return uniquePatterns; };