0.1.0 • Published 4 months ago

@welshman/store v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@welshman/store version

Utilities for dealing with svelte stores when using welshman.

import {Repository, NAMED_PEOPLE, NAMED_TOPICS, type TrustedEvent, readUserList, List} from '@welshman/util'
import {deriveEventsMapped} from '@welshman/store'

const repository = new Repository()

// Create a svelte store that performantly maps matching events in the repository to List objects
const lists = deriveEventsMapped<PublishedUserList>(repository, {
  filters: [{kinds: [NAMED_PEOPLE, NAMED_TOPICS]}],
  eventToItem: (event: TrustedEvent) => (event.tags.length > 1 ? readUserList(event) : null),
  itemToEvent: (list: List) => list.event,
})
0.1.0

4 months ago

0.0.16

5 months ago

0.0.15

6 months ago

0.0.13

7 months ago

0.0.14

6 months ago

0.0.12

8 months ago

0.0.11

8 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.5

10 months ago

0.0.7

9 months ago

0.0.6

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

11 months ago

0.0.1

11 months ago