MCPcopy Create free account
hub / github.com/emwalker/digraph / parts

Method parts

client/src/components/ui/SearchBox/queryFromState.ts:10–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8 }
9
10 get parts() {
11 const buffer: string[] = []
12 const { blocks, entityMap } = this.data
13
14 blocks.forEach(({ text, entityRanges }) => {
15 let lastStart = 0
16
17 entityRanges.forEach(({ offset, length, key }) => {
18 if (offset !== lastStart) buffer.push(text.slice(lastStart, offset))
19
20 const { data: { mention } } = entityMap[key]
21
22 if (mention !== undefined) {
23 const { link } = mention
24 buffer.push(`in:${link}`)
25 lastStart = offset + length
26 }
27 })
28
29 if (lastStart !== text.length) buffer.push(text.slice(lastStart))
30 })
31
32 return buffer
33 }
34
35 toString = () => this.parts.join('')
36}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected