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

Function splitLines

src/ui-server/api/source.ts:143–153  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

141 * dropped per line so it does not render as a stray glyph.
142 */
143export function splitLines(content: string): string[] {
144 const lines = content.split('\n');
145 for (let i = 0; i < lines.length; i++) {
146 const line = lines[i] as string;
147 if (line.endsWith('\r')) lines[i] = line.slice(0, -1);
148 }
149 // A file ending in a newline splits to a final empty string that is not a
150 // line of source. Every other trailing empty line IS one.
151 if (lines.length > 1 && lines[lines.length - 1] === '') lines.pop();
152 return lines;
153}
154
155/**
156 * The whole text of an INDEXED file, or `null` for anything unreadable.

Callers 3

loadFileFunction · 0.90
readFileShapeFunction · 0.85
buildSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected