()
| 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected