mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-17 04:14:25 +01:00
refactor: write map function in a cleaner way
This commit is contained in:
@@ -112,9 +112,9 @@ async function searchEvents({ q, type, limit, account_id }: SearchQuery, signal:
|
||||
|
||||
if (type !== 'accounts') return events;
|
||||
|
||||
events = pubkeys.map((pubkey) => {
|
||||
return events.find((event) => event.pubkey === pubkey);
|
||||
}).filter((event) => event !== undefined);
|
||||
events = pubkeys
|
||||
.map((pubkey) => events.find((event) => event.pubkey === pubkey))
|
||||
.filter((event) => !!event);
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user