MCPcopy Create free account
hub / github.com/Snapchat/Valdi / isSubdirectoryOf

Function isSubdirectoryOf

valdi/vscode_debugger/src/common/pathUtils.ts:192–195  ·  view source on GitHub ↗
(parent: string, child: string)

Source from the content-addressed store, hash-verified

190 * Gets whether the child is a subdirectory of its parent.
191 */
192export const isSubdirectoryOf = (parent: string, child: string) => {
193 const rel = path.relative(parent, child);
194 return rel.length && !path.isAbsolute(rel) && !rel.startsWith('..');
195};
196
197/**
198 * Returns whether the path looks like a UNC path.

Callers 5

absolutePathToUrlMethod · 0.90
inferWorkingDirectoryFunction · 0.90
guessOutFilesFunction · 0.90
guessOutFilesFunction · 0.90
_humanNameMethod · 0.90

Calls 2

isAbsoluteMethod · 0.80
startsWithMethod · 0.80

Tested by

no test coverage detected