INNER CODE UNIT · JavaScript

findNearestParentListing

mikelove/bioc-refcard · README_files/libs/quarto-html/quarto.js:286

  const findNearestParentListing = (href, listingHrefs) => {
    if (!href || !listingHrefs) {
      return undefined;
    }
    // Look up the tree for a nearby linting and use that if we find one
    const relativeParts = href.substring(1).split("/");
    while (relativeParts.length > 0) {
      const path = relativeParts.join("/");
      for (const listingHref of listingHrefs) {
        if (listingHref.startsWith(path)) {
          return listingHref;
        }
      }
      relativeParts.pop();
    }

    return undefined;
  };

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…