MCPcopy Index your code
hub / github.com/angular/angular-cli / findUp

Function findUp

packages/angular_devkit/architect/bin/architect.ts:18–39  ·  view source on GitHub ↗
(names: string | string[], from: string)

Source from the content-addressed store, hash-verified

16import { WorkspaceNodeModulesArchitectHost } from '../node/index';
17
18function findUp(names: string | string[], from: string) {
19 const filenames = Array.isArray(names) ? names : [names];
20
21 let currentDir = path.resolve(from);
22 while (true) {
23 for (const name of filenames) {
24 const p = path.join(currentDir, name);
25 if (existsSync(p)) {
26 return p;
27 }
28 }
29
30 const parentDir = path.dirname(currentDir);
31 if (parentDir === currentDir) {
32 break;
33 }
34
35 currentDir = parentDir;
36 }
37
38 return null;
39}
40
41/**
42 * Show usage of the CLI tool, and exit the process.

Callers 1

mainFunction · 0.70

Calls 2

existsSyncFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected