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

6 months ago

0.0.15

7 months ago

0.0.13

7 months ago

0.0.14

7 months ago

0.0.12

9 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

10 months ago

0.0.5

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

12 months ago