mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor: write map function in a cleaner way
This commit is contained in:
parent
c5711ea071
commit
dc69f21e0b
2 changed files with 6 additions and 6 deletions
|
|
@ -142,9 +142,9 @@ const accountSearchController: AppController = async (c) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!event) {
|
if (!event) {
|
||||||
events = pubkeys.map((pubkey) => {
|
events = pubkeys
|
||||||
return events.find((event) => event.pubkey === pubkey);
|
.map((pubkey) => events.find((event) => event.pubkey === pubkey))
|
||||||
}).filter((event) => event !== undefined);
|
.filter((event) => !!event);
|
||||||
}
|
}
|
||||||
const accounts = await hydrateEvents({ events, store, signal }).then(
|
const accounts = await hydrateEvents({ events, store, signal }).then(
|
||||||
(events) =>
|
(events) =>
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,9 @@ async function searchEvents({ q, type, limit, account_id }: SearchQuery, signal:
|
||||||
|
|
||||||
if (type !== 'accounts') return events;
|
if (type !== 'accounts') return events;
|
||||||
|
|
||||||
events = pubkeys.map((pubkey) => {
|
events = pubkeys
|
||||||
return events.find((event) => event.pubkey === pubkey);
|
.map((pubkey) => events.find((event) => event.pubkey === pubkey))
|
||||||
}).filter((event) => event !== undefined);
|
.filter((event) => !!event);
|
||||||
|
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue