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

Function collectRefs

scripts/sync-sidebar.js:238–262  ·  view source on GitHub ↗
(block)

Source from the content-addressed store, hash-verified

236}
237
238function collectRefs(block) {
239 const refs = [];
240 const lines = block.split(/\r?\n/);
241
242 for (const line of lines) {
243 const simpleEntry = line.match(/^\s*["']([^"']+)["'],?\s*(?:\/\/.*)?$/);
244 if (simpleEntry) {
245 const slug = normalizeRef(simpleEntry[1]);
246 if (slug) {
247 refs.push({ slug, value: simpleEntry[1], kind: "entry" });
248 }
249 continue;
250 }
251
252 const linkEntry = line.match(/\blink\s*:\s*["']([^"']+)["']/);
253 if (linkEntry) {
254 const slug = normalizeRef(linkEntry[1]);
255 if (slug) {
256 refs.push({ slug, value: linkEntry[1], kind: "link" });
257 }
258 }
259 }
260
261 return refs;
262}
263
264function normalizeRef(value) {
265 if (

Callers 1

syncTargetFunction · 0.85

Calls 1

normalizeRefFunction · 0.85

Tested by

no test coverage detected