MCPcopy
hub / github.com/byoungd/up / routeToFile

Function routeToFile

scripts/check-content.mjs:40–47  ·  view source on GitHub ↗

把 Docsify 的 `/threads/...` 路由解析为 docs 下的真实文件路径。

(route)

Source from the content-addressed store, hash-verified

38
39/** 把 Docsify 的 `/threads/...` 路由解析为 docs 下的真实文件路径。 */
40function routeToFile(route) {
41 let r = route.replace(/^\//, "");
42 if (r === "") return join(DOCS, "README.md");
43 const p = join(DOCS, decodeURIComponent(r));
44 if (r.endsWith("/")) return join(p, "README.md");
45 if (!extname(p)) return p + ".md";
46 return p;
47}
48
49/**
50 * 把一个链接目标解析为应当存在的本地文件;返回 null 表示无需校验

Callers 1

resolveTargetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected