MCPcopy Create free account
hub / github.com/pacexy/flow / searchInSection

Method searchInSection

apps/reader/src/models/reader.ts:288–306  ·  view source on GitHub ↗
(keyword = this.keyword, section = this.section)

Source from the content-addressed store, hash-verified

286 }
287
288 searchInSection(keyword = this.keyword, section = this.section) {
289 if (!section) return
290
291 const subitems = section.find(keyword) as unknown as IMatch[]
292 if (!subitems.length) return
293
294 const navItem = section.navitem
295 if (navItem) {
296 const path = this.getNavPath(navItem)
297 path.pop()
298 return {
299 id: navItem.href,
300 excerpt: navItem.label,
301 description: path.map((i) => i.label).join(' / '),
302 subitems: subitems.map((i) => ({ ...i, id: i.cfi! })),
303 expanded: true,
304 }
305 }
306 }
307
308 search(keyword = this.keyword) {
309 // avoid blocking input

Callers 2

searchMethod · 0.95
DefinitionFunction · 0.80

Calls 3

getNavPathMethod · 0.95
mapMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected