Skip to content

Commit

Permalink
Early return
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepinho committed Jan 3, 2025
1 parent 72c79e6 commit 35f28b0
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ export default function transactionSearchTextFilter(searchText: string) {

return (transaction: Transaction): boolean => {
const memoLowerCase = transaction.memo?.toLocaleLowerCase();
if (memoLowerCase?.includes(searchTextLowerCase)) return true;

switch (transaction.type) {
case 'receive':
return !!(
transaction.senderAddress.toLocaleLowerCase().includes(searchTextLowerCase) ||
transaction.senderUsername?.includes(searchTextLowerCase) ||
memoLowerCase?.includes(searchTextLowerCase)
transaction.senderUsername?.includes(searchTextLowerCase)
);

case 'send':
return !!(
transaction.recipientAddress.toLocaleLowerCase().includes(searchTextLowerCase) ||
transaction.recipientUsername?.toLocaleLowerCase().includes(searchTextLowerCase) ||
memoLowerCase?.includes(searchTextLowerCase)
transaction.recipientUsername?.toLocaleLowerCase().includes(searchTextLowerCase)
);

default:
Expand Down

0 comments on commit 35f28b0

Please sign in to comment.