<commit_before>export interface Route {
  name: string;
  hash: string;
  path: string;
  specificity: string;
  handler: string;
  data: any;
  children?: Array<Route>;
  isAux: boolean;
}

export interface MainRoute {
  name: string;
  children: Array<Route>;
}

// *** Component Router ***
export function parseRoutes(router: any): MainRoute {
  const rootName = router.rootComponentType.name;
  const rootChildren: [any] = router.config;

  const root = {
    handler: rootName,
    name: rootName,
    path: '/',
    children: rootChildren ? assignChildrenToParent(null, rootChildren) : []
  };

  return root;
}

function assignChildrenToParent(parent, children): [any] {
  return children.map((child) => {
    const childName = childRouteName(child);
    const childDescendents: [any] = child._loadedConfig ? child._loadedConfig.routes : child.children;

    // only found in aux routes, otherwise property will be undefined
    const isAuxRoute = !!child.outlet;

    return {
      handler: childName,
      name: childName,
      parent: parent,
      path: `/${child.path}`,
      isAux: isAuxRoute,
      children: childDescendents ?
        assignChildrenToParent(this, childDescendents) : []
    };
  });
}

function childRouteName(child): string {
  if (child.component) {
    return child.component.name;
  }
  if (child.loadChildren) {
    return `${child.path} [Lazy]`;
  }
  return 'no-name-route';
}<commit_msg>Improve if/else<commit_after>export interface Route {
  name: string;
  hash: string;
  path: string;
  specificity: string;
  handler: string;
  data: any;
  children?: Array<Route>;
  isAux: boolean;
}

export interface MainRoute {
  name: string;
  children: Array<Route>;
}

// *** Component Router ***
export function parseRoutes(router: any): MainRoute {
  const rootName = router.rootComponentType.name;
  const rootChildren: [any] = router.config;

  const root = {
    handler: rootName,
    name: rootName,
    path: '/',
    children: rootChildren ? assignChildrenToParent(null, rootChildren) : []
  };

  return root;
}

function assignChildrenToParent(parent, children): [any] {
  return children.map((child) => {
    const childName = childRouteName(child);
    const childDescendents: [any] = child._loadedConfig ? child._loadedConfig.routes : child.children;

    // only found in aux routes, otherwise property will be undefined
    const isAuxRoute = !!child.outlet;

    return {
      handler: childName,
      name: childName,
      parent: parent,
      path: `/${child.path}`,
      isAux: isAuxRoute,
      children: childDescendents ?
        assignChildrenToParent(this, childDescendents) : []
    };
  });
}

function childRouteName(child): string {
  if (child.component) {
    return child.component.name;
  }
  else if (child.loadChildren) {
    return `${child.path} [Lazy]`;
  }
  else {
    return 'no-name-route';
  }
}
{'fraction_non_alphanumeric': 0.1251733703190014, 'fraction_numerical': 0.0, 'mean_word_length': 3.4728682170542635, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4605787', 'n_tokens_mistral': 902, 'n_tokens_neox': 897, 'n_words': 223}