Skip to content

Commit

Permalink
chore(word): cleanup word filtering (#3262)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Nov 21, 2024
1 parent 4436a77 commit 382c034
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/modules/word/filter-word-list-by-length.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ const STRATEGIES = {
'any-length': (wordList: ReadonlyArray<string>): string[] => {
return [...wordList];
},
} as const; /*
satisfies Record<
string, // Parameters<filterWordListByLength>[0]['strategy']
(wordList: string[], length: { min: number; max: number }) => string[]
} satisfies Record<
NonNullable<Parameters<typeof filterWordListByLength>[0]['strategy']>,
(wordList: string[], length: { min: number; max: number }) => string[]
>;
*/

/**
* Filters a string array for values with a matching length.
Expand All @@ -70,7 +68,7 @@ export function filterWordListByLength(options: {
}): string[] {
const { wordList, length, strategy = 'any-length' } = options;

if (length) {
if (length != null) {
const filter: (word: string) => boolean =
typeof length === 'number'
? (word) => word.length === length
Expand Down

0 comments on commit 382c034

Please sign in to comment.