src/http/get-index/ssr.js
/**
 * Given an array of nodes, remove any member that is contained by another.
 *
 * @param nodes Nodes to filter.
 * @returns Remaining nodes that aren't subtrees of each other.
 */
Given an array of nodes, remove any member that is contained by another.
@param nodes Nodes to filter.
@returns Remaining nodes that aren't subtrees of each other.
Given an array of nodes remove any member that is contained by another . @param nodes Nodes to filter . @returns Remaining nodes that aren ' t subtrees of each other .
function removeSubsets$1(nodes) {
  var idx = nodes.length;
  while (--idx >= 0) {
    var node = nodes[idx];
    if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
      nodes.splice(idx, 1);
      continue;
    }
    for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
      if (nodes.includes(ancestor)) {
        nodes.splice(idx, 1);
        break;
      }
    }
  }
  return nodes;
}
function removeSubsets$1 ( nodes ) { var idx = nodes . length ; while ( -- idx >= 0 ) { var node = nodes [ idx ] ; if ( idx > 0 && nodes . lastIndexOf ( node , idx - 1 ) >= 0 ) { nodes . splice ( idx , 1 ) ; continue ; } for ( var ancestor = node . parent ; ancestor ; ancestor = ancestor . parent ) { if ( nodes . includes ( ancestor ) ) { nodes . splice ( idx , 1 ) ; break ; } } } return nodes ; }
Given an array of nodes, remove any member that is contained by another.
Given an array of nodes remove any member that is contained by another .
/*
   * Check if each node (or one of its ancestors) is already contained in the
   * array.
   */ /*
     * Remove the node if it is not unique.
     * We are going through the array from the end, so we only
     * have to check nodes that preceed the node under consideration in the array.
     */