MCPcopy Create free account
hub / github.com/BuilderIO/SSDiff / getLinks

Function getLinks

packages/ssdiff/example/index.js:6–23  ·  view source on GitHub ↗
(links, result)

Source from the content-addressed store, hash-verified

4
5// Function to filter links from an external source
6const getLinks = (links, result) => {
7 links.forEach((link) => {
8 if (link.subLinks) {
9 getLinks(link.subLinks, result);
10 } else {
11 // only take the links that are in the docs
12 if (link.link.indexOf("/c/docs") !== -1) {
13 try {
14 const url = new URL(link.link);
15 result.push(url.pathname);
16 } catch (e) {
17 result.push(link.link);
18 }
19 }
20 }
21 });
22 return result;
23};
24
25const helper = async () => {
26 const pathnames = ["/c/docs/developers"];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected