(url: string)
| 6 | } |
| 7 | |
| 8 | export function isImageUrl(url: string): boolean { |
| 9 | if (!url) return false; |
| 10 | const imageExtensions = [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp"]; |
| 11 | |
| 12 | const isDataUri = url.startsWith("data:image/"); |
| 13 | |
| 14 | const isImageExtension = |
| 15 | imageExtensions.includes( |
| 16 | url.substring(url.lastIndexOf(".")).toLowerCase(), |
| 17 | ) || url.endsWith(".svg"); |
| 18 | |
| 19 | // Add check for GitHub avatar URLs |
| 20 | const isGitHubAvatar = url.includes("avatars.githubusercontent.com"); |
| 21 | |
| 22 | // Add check for URLs with 'image' in the path or query parameters |
| 23 | const hasImageInUrl = url.toLowerCase().includes("image"); |
| 24 | |
| 25 | return isDataUri || isImageExtension || isGitHubAvatar || hasImageInUrl; |
| 26 | } |
| 27 | |
| 28 | export function formatCount(n: number): string { |
| 29 | if (n >= 1_000_000) |
nothing calls this directly
no outgoing calls
no test coverage detected