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

Function removeStaleStringEntries

scripts/sync-sidebar.js:279–299  ·  view source on GitHub ↗
(block, staleSlugs)

Source from the content-addressed store, hash-verified

277}
278
279function removeStaleStringEntries(block, staleSlugs) {
280 const stale = new Set(staleSlugs);
281 const removed = [];
282 const lines = block.split(/\r?\n/);
283 const nextLines = [];
284
285 for (const line of lines) {
286 const simpleEntry = line.match(/^\s*["']([^"']+)["'],?\s*(?:\/\/.*)?$/);
287 const slug = simpleEntry ? normalizeRef(simpleEntry[1]) : null;
288 if (slug && stale.has(slug)) {
289 removed.push(slug);
290 continue;
291 }
292 nextLines.push(line);
293 }
294
295 return {
296 block: nextLines.join("\n"),
297 removed,
298 };
299}
300
301function appendMissingEntries(block, missingFiles, fallbackGroup) {
302 const warnings = [];

Callers 1

syncTargetFunction · 0.85

Calls 1

normalizeRefFunction · 0.85

Tested by

no test coverage detected