MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / readRouteNodes

Function readRouteNodes

core/src/components/router/utils/parser.ts:45–59  ·  view source on GitHub ↗
(node: Element)

Source from the content-addressed store, hash-verified

43 * Note: routes without a component are ignored together with their children.
44 */
45export const readRouteNodes = (node: Element): RouteTree => {
46 return (Array.from(node.children) as HTMLIonRouteElement[])
47 .filter((el) => el.tagName === 'ION-ROUTE' && el.component)
48 .map((el) => {
49 const component = readProp(el, 'component') as string;
50 return {
51 segments: parsePath(readProp(el, 'url')).segments,
52 id: component.toLowerCase(),
53 params: el.componentProps,
54 beforeLeave: el.beforeLeave,
55 beforeEnter: el.beforeEnter,
56 children: readRouteNodes(el),
57 };
58 });
59};
60
61/**
62 * Flattens a RouterTree in a list of chains.

Callers 2

parser.spec.tsxFile · 0.90
readRoutesFunction · 0.85

Calls 3

parsePathFunction · 0.90
readPropFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected