faviconUrl.ts raw

   1  import UriTemplate from 'uri-templates'
   2  
   3  export function faviconUrl(template: string, url: string | URL): string {
   4    const u = new URL(url)
   5  
   6    return UriTemplate(template).fill({
   7      href: u.href,
   8      origin: u.origin,
   9      protocol: u.protocol,
  10      username: u.username,
  11      password: u.password,
  12      host: u.host,
  13      hostname: u.hostname,
  14      port: u.port,
  15      pathname: u.pathname,
  16      hash: u.hash,
  17      search: u.search
  18    })
  19  }
  20