MCPcopy Create free account
hub / github.com/effector/effector / getBreadcrumbs

Function getBreadcrumbs

documentation/src/docs.ts:29–51  ·  view source on GitHub ↗
({
  path: originalPath,
  docs,
}: {
  path: string;
  docs: Record<string, DocsEntry>;
})

Source from the content-addressed store, hash-verified

27}
28
29export function getBreadcrumbs({
30 path: originalPath,
31 docs,
32}: {
33 path: string;
34 docs: Record<string, DocsEntry>;
35}) {
36 const path = originalPath.replace(/\/$/, "").replace(/^\//, "");
37 const breadcrumbs = [];
38
39 let foundIndex = 0;
40 while ((foundIndex = path.indexOf("/", foundIndex + 1)) !== -1) {
41 const part = path.slice(0, foundIndex);
42 breadcrumbs.push(part);
43 }
44
45 return breadcrumbs
46 .filter((path) => docs[path])
47 .map((path) => ({
48 title: docs[path].data.title,
49 path: `/${path}`,
50 }));
51}

Callers

nothing calls this directly

Calls 2

mapMethod · 0.65
filterMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…