MCPcopy Index your code
hub / github.com/pyscript/pyscript / crawl

Function crawl

core/rollup/build_test_index.cjs:11–29  ·  view source on GitHub ↗
(path, tree = {})

Source from the content-addressed store, hash-verified

9const TEST_INDEX = join(TEST_DIR, "index.html");
10
11const crawl = (path, tree = {}) => {
12 for (const file of readdirSync(path)) {
13 const current = join(path, file);
14 if (current === TEST_INDEX) continue;
15 if (lstatSync(current).isDirectory()) {
16 if (EXCLUDE_DIR.has(file)) continue;
17 const sub = {};
18 tree[file] = sub;
19 crawl(current, sub);
20 if (!Reflect.ownKeys(sub).length) {
21 delete tree[file];
22 }
23 } else if (file.endsWith(".html")) {
24 const name = file === "index.html" ? "." : file.slice(0, -5);
25 tree[name] = current.replace(TEST_DIR, "");
26 }
27 }
28 return tree;
29};
30
31const createList = (tree) => {
32 const ul = ["<ul>"];

Callers 1

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected