MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / walk

Function walk

packages/vite/helpers/ns-cli-plugins.ts:135–157  ·  view source on GitHub ↗
(dir: string, relBase = '')

Source from the content-addressed store, hash-verified

133function listFilesFlat(rootDir: string): string[] {
134 const results: string[] = [];
135 function walk(dir: string, relBase = '') {
136 let entries: string[] = [];
137 try {
138 entries = readdirSync(dir);
139 } catch {
140 return;
141 }
142 for (const name of entries) {
143 const abs = path.join(dir, name);
144 const rel = path.join(relBase, name);
145 let s;
146 try {
147 s = statSync(abs);
148 } catch {
149 continue;
150 }
151 if (s.isDirectory()) {
152 walk(abs, rel);
153 } else if (s.isFile()) {
154 results.push(rel);
155 }
156 }
157 }
158 walk(rootDir);
159 return results;
160}

Callers 1

listFilesFlatFunction · 0.70

Calls 2

joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected