src/http/get-index/ssr.js
/**
 * Finds one element in a tree that passes a test.
 *
 * @param test Function to test nodes on.
 * @param nodes Array of nodes to search.
 * @param recurse Also consider child nodes.
 * @returns The first child node that passes `test`.
 */
Finds one element in a tree that passes a test.
@param test Function to test nodes on.
@param nodes Array of nodes to search.
@param recurse Also consider child nodes.
@returns The first child node that passes `test`.
Finds one element in a tree that passes a test . @param test Function to test nodes on . @param nodes Array of nodes to search . @param recurse Also consider child nodes . @returns The first child node that passes ` test ` .
function findOne$1(test, nodes, recurse) {
  if (recurse === void 0) {recurse = true;}
  var elem = null;
  for (var i = 0; i < nodes.length && !elem; i++) {
    var checked = nodes[i];
    if (!domhandler_1$3.isTag(checked)) {
      continue;
    } else
    if (test(checked)) {
      elem = checked;
    } else
    if (recurse && checked.children.length > 0) {
      elem = findOne$1(test, checked.children);
    }
  }
  return elem;
}
function findOne$1 ( test , nodes , recurse ) { if ( recurse === void 0 ) { recurse = true ; } var elem = null ; for ( var i = 0 ; i < nodes . length && ! elem ; i ++ ) { var checked = nodes [ i ] ; if ( ! domhandler_1$3 . isTag ( checked ) ) { continue ; } else if ( test ( checked ) ) { elem = checked ; } else if ( recurse && checked . children . length > 0 ) { elem = findOne$1 ( test , checked . children ) ; } } return elem ; }
Finds one element in a tree that passes a test.
Finds one element in a tree that passes a test .