MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / search

Method search

tools/xsbug-log/xsbug-debugmachine.js:1274–1287  ·  view source on GitHub ↗
(dir, depth)

Source from the content-addressed store, hash-verified

1272 }
1273 const skip = new Set(['.git', 'node_modules', 'build']);
1274 const search = (dir, depth) => {
1275 if (depth <= 0 || results.length >= 4) return;
1276 try {
1277 const entries = fs.readdirSync(dir, { withFileTypes: true });
1278 for (const entry of entries) {
1279 if (entry.isFile() && names.includes(entry.name))
1280 results.push(dir + '/' + entry.name);
1281 }
1282 for (const entry of entries) {
1283 if (entry.isDirectory() && !entry.name.startsWith('.') && !skip.has(entry.name))
1284 search(dir + '/' + entry.name, depth - 1);
1285 }
1286 } catch (e) {}
1287 };
1288 search(baseDir, maxDepth);
1289 return results;
1290 }

Callers 3

onFindEditedMethod · 0.45
__377.jsFile · 0.45
__635.jsFile · 0.45

Calls 4

isFileMethod · 0.45
pushMethod · 0.45
isDirectoryMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected