MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / lineStartsOf

Function lineStartsOf

src/extraction/objcpp-extractor.ts:31–35  ·  view source on GitHub ↗

Offsets of the file's line starts, for the offset of a 1-based line and a column.

(source: string)

Source from the content-addressed store, hash-verified

29
30/** Offsets of the file's line starts, for the offset of a 1-based line and a column. */
31function lineStartsOf(source: string): number[] {
32 const starts = [0];
33 for (let k = source.indexOf('\n'); k >= 0; k = source.indexOf('\n', k + 1)) starts.push(k + 1);
34 return starts;
35}
36
37/** The index of the last range starting at or before `offset`, or -1. */
38function lastStartingBefore(starts: ArrayLike<number>, offset: number): number {

Callers 1

extractObjcppFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected