MCPcopy Create free account
hub / github.com/cursor/community-plugins / isImageUrl

Function isImageUrl

apps/cursor/src/lib/utils.ts:8–26  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

6}
7
8export 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
28export function formatCount(n: number): string {
29 if (n >= 1_000_000)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected