dist/index.js
function _default(base, link) {
  // Dynamic stuff:
  if (typeof link !== "string" || link.match(REGEX_DYNAMIC)) {
    return base;
  } // Link is absolute:


  if (link.match(REGEX_ABSOLUTE)) {
    try {
      const parsedBase = parseLink(base);
      const parsedLink = parseLink(link); // Both `base` and `link` are on different domains:

      if (parsedBase.domain !== parsedLink.domain) {
        return false;
      } // Absolute path from same domain:


      if (parsedLink.path) {
        return (0, _url.resolve)(base, parsedLink.path);
      } // Same domains without path:


      return (0, _url.parse)(base).href;
    } catch (err) {
      return false;
    }
  } // Relative stuff:


  return regenerateLink(base, link);
}
function _default(base, link) {
  // Dynamic stuff:
  if (typeof link !== "string" || link.match(REGEX_DYNAMIC)) {
    return base;
  } // Link is absolute:


  if (link.match(REGEX_ABSOLUTE)) {
    try {
      const parsedBase = parseLink(base);
      const parsedLink = parseLink(link); // Both `base` and `link` are on different domains:

      if (parsedBase.domain !== parsedLink.domain) {
        return false;
      } // Absolute path from same domain:


      if (parsedLink.path) {
        return (0, _url.resolve)(base, parsedLink.path);
      } // Same domains without path:


      return (0, _url.parse)(base).href;
    } catch (err) {
      return false;
    }
  } // Relative stuff:


  return regenerateLink(base, link);
}
function _default ( base , link ) { // Dynamic stuff: if ( typeof link !== "string" || link . match ( REGEX_DYNAMIC ) ) { return base ; } // Link is absolute: if ( link . match ( REGEX_ABSOLUTE ) ) { try { const parsedBase = parseLink ( base ) ; const parsedLink = parseLink ( link ) ; // Both `base` and `link` are on different domains: if ( parsedBase . domain !== parsedLink . domain ) { return false ; } // Absolute path from same domain: if ( parsedLink . path ) { return ( 0 , _url . resolve ) ( base , parsedLink . path ) ; } // Same domains without path: return ( 0 , _url . parse ) ( base ) . href ; } catch ( err ) { return false ; } } // Relative stuff: return regenerateLink ( base , link ) ; }
Transform a relative path into an absolute url.

@param   {string}    base    Absolute base url
@param   {string}    link    Link to parse
@return  {string|false}      Absolute path
Transform a relative path into an absolute url .