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 (14 loc) • 341 B
text/typescript
export const createNullMovingComparator = <T>(direction: 'left' | 'right') => {
return (a: T | null, b: T | null): number => {
if (a === b) {
return 0;
}
if (a === null) {
return direction === 'right' ? 1 : -1;
}
if (b === null) {
return direction === 'right' ? -1 : 1;
}
return 0;
};
};