code: function regenerateLink(base, link) {
    const parsedBase = (0, _url.parse)(base);
    const parsedLink = link.split("/");
    let parts = [];
    let port = "";
  
    if (!link.startsWith("/")) {
      parts = parsedBase.pathname.split("/");
      parts.pop();
    }
  
    for (const part of parsedLink) {
      // Current directory:
      if (part === ".") {
        continue;
      } // Parent directory:
  
  
      if (part === "..") {
        // Accessing non-existing parent directories:
        if (!parts.pop() || parts.length === 0) {
          return null;
        }
      } else {
        parts.push(part);
      }
    }
  
    if (parsedBase.port) {
      port = ":" + parsedBase.port;
    } // eslint-disable-next-line max-len
  
  
    return `${parsedBase.protocol}//${parsedBase.hostname}${port}${parts.join("/")}`;
  }
docs: Regenerates an absolute URL from `base` and relative `link`.
  
  @param   {string}    base    Absolute base url
  @param   {string}    link    Relative link
  @return  {string|null}