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

Function nearestDirectoryContaining

valdi/vscode_debugger/src/common/urlUtils.ts:78–79  ·  view source on GitHub ↗
(rootDir: string, file: string)

Source from the content-addressed store, hash-verified

76 * Returns the closest parent directory that contains a file with the given name.
77 */
78export const nearestDirectoryContaining = (rootDir: string, file: string) =>
79 nearestDirectoryWhere(rootDir, p => exists(path.join(p, file)));
80
81// todo: not super correct, and most node libraries don't handle this accurately
82const knownLoopbacks = new Set<string>(['localhost', '127.0.0.1', '::1']);

Callers 3

inferWorkingDirectoryFunction · 0.90
guessOutFilesFunction · 0.90
guessOutFilesFunction · 0.90

Calls 3

existsFunction · 0.90
nearestDirectoryWhereFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected