MCPcopy Create free account
hub / github.com/acode/cli / findPath

Function findPath

cli/credentials.js:7–28  ·  view source on GitHub ↗
(maxDepth)

Source from the content-addressed store, hash-verified

5const FILENAME = '.stdlib';
6
7function findPath (maxDepth) {
8
9 maxDepth = parseInt(maxDepth) || 0;
10
11 let cwd = process.cwd();
12 let directories = cwd.split(path.sep);
13 let stdlibPath = '';
14
15 for (let i = directories.length; i > 0; i--) {
16 let relpath = path.join(directories.slice(0, i).join(path.sep), FILENAME);
17 if (fs.existsSync(relpath)) {
18 stdlibPath = relpath;
19 break;
20 }
21 if (!(--maxDepth)) {
22 break;
23 }
24 }
25
26 return stdlibPath;
27
28}
29
30function readCredentials() {
31

Callers 3

readCredentialsFunction · 0.85
writeCredentialsFunction · 0.85
credentials.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected