MCPcopy Index your code
hub / github.com/itwanger/toBeBetterJavaer / normalizeRef

Function normalizeRef

scripts/sync-sidebar.js:264–277  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

262}
263
264function normalizeRef(value) {
265 if (
266 !value ||
267 value.startsWith("/") ||
268 value.startsWith("#") ||
269 /^[a-z]+:\/\//i.test(value) ||
270 value.endsWith("/") ||
271 value.includes("/")
272 ) {
273 return null;
274 }
275
276 return value.endsWith(".md") ? value.slice(0, -".md".length) : value;
277}
278
279function removeStaleStringEntries(block, staleSlugs) {
280 const stale = new Set(staleSlugs);

Callers 2

collectRefsFunction · 0.85
removeStaleStringEntriesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected