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

Function levelEnds

src/ui-server/api/map.ts:266–274  ·  view source on GitHub ↗

* Where each level of a file's directory path ends, as indexes into `dirs`: a * level is one folder plus every pass-through folder that follows it.

(root: string, dirs: readonly string[], passThrough: ReadonlySet<string> | undefined)

Source from the content-addressed store, hash-verified

264 * level is one folder plus every pass-through folder that follows it.
265 */
266function levelEnds(root: string, dirs: readonly string[], passThrough: ReadonlySet<string> | undefined): number[] {
267 const ends: number[] = [];
268 for (let i = 0; i < dirs.length; ) {
269 i++;
270 while (passThrough && i < dirs.length && passThrough.has(joinPath(root, dirs.slice(0, i)))) i++;
271 ends.push(i);
272 }
273 return ends;
274}
275
276function joinPath(root: string, segments: readonly string[]): string {
277 return [root, ...segments].filter(Boolean).join('/');

Callers 2

moduleIdForFunction · 0.85
pickDefaultDepthFunction · 0.85

Calls 3

hasMethod · 0.80
pushMethod · 0.80
joinPathFunction · 0.70

Tested by

no test coverage detected