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

Function isSameOrUnder

src/utils.ts:93–96  ·  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

91 * the root starts with, so a project at a drive root indexed nothing (#415).
92 */
93function isSameOrUnder(child: string, parent: string): boolean {
94 if (child === parent) return true;
95 return child.startsWith(parent.endsWith(path.sep) ? parent : parent + path.sep);
96}
97
98/**
99 * 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