Skip to content

Commit

Permalink
Make voter name filter easier to read
Browse files Browse the repository at this point in the history
Co-authored-by: lubej <[email protected]>
  • Loading branch information
csillag and lubej committed May 16, 2024
1 parent d0d48c6 commit 3111f56
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/utils/vote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ const voteFilters: Record<VoteType, VoteFilter> = {

export const getFilterForVoteType = (voteType: VoteType): VoteFilter => voteFilters[voteType]

export const getFilterForVoterNameFragment = (fragment: string | undefined) =>
fragment ? (vote: ExtendedVote) => hasTextMatch(vote.validator?.media?.name, [fragment]) : () => true
export const getFilterForVoterNameFragment = (fragment: string | undefined) => {
if (!fragment) {
return () => true
}
return (vote: ExtendedVote) => hasTextMatch(vote.validator?.media?.name, [fragment])
}

0 comments on commit 3111f56

Please sign in to comment.