💡 Turns out it's quite simple to write. Not very performant, but will do for now.

import { matchFilter, type Event, type Filter } from "nostr-tools"

export class MemStore {

events: Event[]

constructor() {

this.events = []

}

add(event: Event) {

this.events.push(event)

}

req(filtr: Filter): Event[] {

let r: Event[] = []

this.events.forEach(e => {

if (matchFilter(filtr, e)) {

r.push(e)

}

})

return r

}

}

Reply to this note

Please Login to reply.

Discussion

No replies yet.