MCPcopy Index your code
hub / github.com/cameri/nostream / isMatchingGenericTagCriterion

Function isMatchingGenericTagCriterion

src/utils/event.ts:43–54  ·  view source on GitHub ↗
(key: string, criterion: string)

Source from the content-addressed store, hash-verified

41 (event: Event): boolean => {
42 const startsWith = (input: string) => (prefix: string) => input.startsWith(prefix)
43 const isMatchingGenericTagCriterion = (key: string, criterion: string) => (tag: Tag): boolean => {
44 const [, tagName] = key
45 if (tag[0] !== tagName) {
46 return false
47 }
48
49 if (isGeohashPrefixCriterion(key, criterion)) {
50 return tag[1].startsWith(stripGeohashPrefixWildcard(criterion))
51 }
52
53 return tag[1] === criterion
54 }
55
56 // NIP-01: Basic protocol flow description
57

Callers 1

isEventMatchingFilterFunction · 0.85

Calls 2

isGeohashPrefixCriterionFunction · 0.90

Tested by

no test coverage detected