UNPKG

scrabble-solver

Version:

Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.

22 lines (17 loc) 580 B
import { Locale, ShowCoordinates } from '@scrabble-solver/types'; import { GroupedResults, Sort } from 'types'; import { sortResults } from './sortResults'; export const sortGroupedResults = ( results: GroupedResults | undefined, sort: Sort, locale: Locale, showCoordinates: ShowCoordinates, ): GroupedResults | undefined => { if (typeof results === 'undefined') { return results; } return { matching: sortResults(results.matching, sort, locale, showCoordinates) ?? [], other: sortResults(results.other, sort, locale, showCoordinates) ?? [], }; };