MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / isWithinProjectRoot

Function isWithinProjectRoot

packages/lint/src/project.ts:119–123  ·  view source on GitHub ↗
(projectDir: string, candidate: string)

Source from the content-addressed store, hash-verified

117}
118
119function isWithinProjectRoot(projectDir: string, candidate: string): boolean {
120 const projectRoot = resolve(projectDir);
121 const relativePath = relative(projectRoot, candidate);
122 return relativePath === "" || (!relativePath.startsWith("..") && !isAbsolute(relativePath));
123}
124
125function addCandidate(candidates: string[], candidate: string): void {
126 if (!candidates.includes(candidate)) candidates.push(candidate);

Callers 1

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected