MCPcopy Create free account
hub / github.com/Snailclimb/JavaGuide / normalizeUrls

Function normalizeUrls

scripts/indexnow-submit.mjs:24–32  ·  view source on GitHub ↗
(urls)

Source from the content-addressed store, hash-verified

22 Array.from(xml.matchAll(/<loc>(.*?)<\/loc>/gu), (match) => match[1]);
23
24const normalizeUrls = (urls) =>
25 Array.from(
26 new Set(
27 urls
28 .map((url) => url.trim())
29 .filter(Boolean)
30 .map((url) => (url.startsWith("http") ? url : `https://${host}${url}`)),
31 ),
32 );
33
34const readSitemapUrls = async () => {
35 const sitemapPath = path.join(cwd, "dist", "sitemap.xml");

Callers 1

submitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected