(url: string)
| 1 | import urlMetadata from 'url-metadata'; |
| 2 | |
| 3 | function fallbackFavicon(url: string) { |
| 4 | try { |
| 5 | const hostname = new URL(url).hostname; |
| 6 | return `https://icons.duckduckgo.com/ip3/${hostname}.ico`; |
| 7 | } catch { |
| 8 | // If URL parsing fails, use the original string |
| 9 | return `https://icons.duckduckgo.com/ip3/${url}.ico`; |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | function findBestFavicon(favicons: UrlMetaData['favicons']) { |
| 14 | const match = favicons |
no outgoing calls
no test coverage detected