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

Function isSameOrUnder

src/utils.ts:94–97  ·  view source on GitHub ↗

* Whether `child` is `parent` or lies under it, compared exactly as given. * * A root (`C:\`, `\\server\share\`, `/`) already ends with its separator, so * none is added to it. Adding one made `C:\\` the prefix, which no path under * the root starts with, so a project at a drive root indexed not

(child: string, parent: string)

Source from the content-addressed store, hash-verified

92 * the root starts with, so a project at a drive root indexed nothing (#415).
93 */
94function isSameOrUnder(child: string, parent: string): boolean {
95 if (child === parent) return true;
96 return child.startsWith(parent.endsWith(path.sep) ? parent : parent + path.sep);
97}
98
99/**
100 * Whether `child` is `parent` itself or sits underneath it. Case-insensitive on

Callers 2

isWithinDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected