billy-herrington-utils 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -496,16 +496,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
496
496
  function getPaginationLinks(doc = document, url = location.href, pathnameSelector = /\/(page\/)?\d+\/?$/) {
497
497
  const currentUrl = parseURL(url);
498
498
  currentUrl.pathname = currentUrl.pathname.replace(pathnameSelector, "/");
499
+ const pathnameStrict = doc instanceof Document;
499
500
  const pageLinks = Array.from(
500
501
  doc.querySelectorAll("a[href]") || [],
501
502
  (a) => a.href
502
503
  ).filter((h) => {
503
504
  try {
504
505
  const linkUrl = new URL(h.replace(/#\w*$/, ""), doc.baseURI || currentUrl.origin);
505
- return (
506
- // in case of origin sometimes it's protocols problem cause some links can be not https but http
507
- linkUrl.hostname === currentUrl.hostname && linkUrl.pathname.startsWith(currentUrl.pathname)
508
- );
506
+ return linkUrl.hostname === currentUrl.hostname && (pathnameStrict ? linkUrl.pathname.startsWith(currentUrl.pathname) : true);
509
507
  } catch {
510
508
  return false;
511
509
  }