From 76e3d78b6f619014eb4d539a9db9715383944e00 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 15 Feb 2026 14:03:12 +0300 Subject: [PATCH] Handle excluded keywords in icon matching logic and update `Icon` type definition --- src/types/icons.ts | 1 + src/utils/icons.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/types/icons.ts b/src/types/icons.ts index a07a733..f84245d 100644 --- a/src/types/icons.ts +++ b/src/types/icons.ts @@ -1,4 +1,5 @@ export interface Icon { query: string; icon: string; + exclude?: string[] } diff --git a/src/utils/icons.ts b/src/utils/icons.ts index 1f2ed4e..f5f7fd0 100644 --- a/src/utils/icons.ts +++ b/src/utils/icons.ts @@ -8,6 +8,7 @@ export const phpIcons: Icon[] = [ { query: "symfony/", icon: "https://symfony.com/logos/symfony_black_03.svg", + exclude: ["polyfill", "var-dumper"] }, ]; @@ -25,9 +26,19 @@ const find = ( for (const name of names) { for (const icon of icons) { - if (name.includes(icon.query)) { + if (! name.includes(icon.query)) { + continue; + } + + if (! icon.exclude) { return icon.icon; } + + for (const exclude of icon.exclude) { + if (name.includes(exclude)) { + return icon.icon; + } + } } }