data/edge5/video/v2/+

This commit is contained in:
2026-07-04 17:26:30 +05:00
parent f61fd87bac
commit e0437edf18
5 changed files with 88 additions and 6 deletions

View File

@@ -0,0 +1,38 @@
export function topicMatchesFilter(filter: string, topic: string): boolean {
const filterParts = filter.split('/')
const topicParts = topic.split('/')
let fi = 0
let ti = 0
while (fi < filterParts.length) {
const segment = filterParts[fi]
if (segment === '#') {
return fi === filterParts.length - 1
}
if (ti >= topicParts.length) {
return false
}
if (segment === '+') {
fi++
ti++
continue
}
if (segment !== topicParts[ti]) {
return false
}
fi++
ti++
}
return ti === topicParts.length
}
export function lastTopicSegment(topic: string): string {
return topic.split('/').at(-1) ?? ''
}