MCPcopy Create free account
hub / github.com/Drakkar-Software/OctoBot / findMdFiles

Function findMdFiles

docs/scripts/shared.mjs:72–96  ·  view source on GitHub ↗
(dir, filter)

Source from the content-addressed store, hash-verified

70 * Optional filter function receives relative path from baseDir.
71 */
72export async function findMdFiles(dir, filter) {
73 const results = [];
74
75 async function walk(current) {
76 let entries;
77 try {
78 entries = await readdir(current, {withFileTypes: true});
79 } catch {
80 return;
81 }
82 for (const entry of entries) {
83 const fullPath = join(current, entry.name);
84 if (entry.isDirectory()) {
85 await walk(fullPath);
86 } else if (entry.isFile() && entry.name.endsWith('.md')) {
87 if (!filter || filter(fullPath)) {
88 results.push(fullPath);
89 }
90 }
91 }
92 }
93
94 await walk(dir);
95 return results;
96}

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls 1

walkFunction · 0.85

Tested by

no test coverage detected