search: fix FTS special characters, optimize search

This commit is contained in:
Alex Gleason
2023-08-30 14:03:16 -05:00
parent df14ff66bc
commit 675010ddec
4 changed files with 58 additions and 14 deletions

View File

@@ -101,8 +101,14 @@ function isFollowing(source: Event<3>, targetPubkey: string): boolean {
);
}
/** Deduplicate events by ID. */
function dedupeEvents<K extends number>(events: Event<K>[]): Event<K>[] {
return [...new Map(events.map((event) => [event.id, event])).values()];
}
export {
bech32ToPubkey,
dedupeEvents,
eventAge,
eventDateComparator,
findTag,