MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / computeLineStarts

Function computeLineStarts

src/tools/filesystem/fuzzy-match.ts:89–95  ·  view source on GitHub ↗

Precompute the char offset at which each line begins.

(content: string)

Source from the content-addressed store, hash-verified

87
88/** Precompute the char offset at which each line begins. */
89function computeLineStarts(content: string): number[] {
90 const starts = [0];
91 for (let i = 0; i < content.length; i++) {
92 if (content[i] === '\n') starts.push(i + 1);
93 }
94 return starts;
95}
96
97/**
98 * Find `search` in `content`, tolerating whitespace and small drift.

Callers 1

findMatchFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected