MCPcopy Create free account
hub / github.com/arktypeio/arktype / textOf

Function textOf

ark/aot/flat.ts:1772–1780  ·  view source on GitHub ↗
(start: number, end: number)

Source from the content-addressed store, hash-verified

1770 const reads = [...moving.keys()].sort((l, r) => l.id.start - r.id.start)
1771 // a span's text with each read within it written as what it reads
1772 const textOf = (start: number, end: number): string => {
1773 let text = ""
1774 for (const read of reads) {
1775 if (read.id.start < start || read.id.end > end) continue
1776 text += code.slice(start, read.id.start) + writtenAt(read)
1777 start = read.id.end
1778 }
1779 return text + code.slice(start, end)
1780 }
1781 const writtenAt = (read: Reference) => {
1782 const { init } = moving.get(read)!
1783 const text = textOf(init!.start, init!.end)

Callers 2

writtenAtFunction · 0.70
inGzipOrderFunction · 0.70

Calls 1

writtenAtFunction · 0.85

Tested by

no test coverage detected