Skip to content

Commit 76e3d78

Browse files
Handle excluded keywords in icon matching logic and update Icon type definition
1 parent 9ba9b5e commit 76e3d78

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/types/icons.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface Icon {
22
query: string;
33
icon: string;
4+
exclude?: string[]
45
}

src/utils/icons.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const phpIcons: Icon[] = [
88
{
99
query: "symfony/",
1010
icon: "https://symfony.com/logos/symfony_black_03.svg",
11+
exclude: ["polyfill", "var-dumper"]
1112
},
1213
];
1314

@@ -25,9 +26,19 @@ const find = (
2526

2627
for (const name of names) {
2728
for (const icon of icons) {
28-
if (name.includes(icon.query)) {
29+
if (! name.includes(icon.query)) {
30+
continue;
31+
}
32+
33+
if (! icon.exclude) {
2934
return icon.icon;
3035
}
36+
37+
for (const exclude of icon.exclude) {
38+
if (name.includes(exclude)) {
39+
return icon.icon;
40+
}
41+
}
3142
}
3243
}
3344

0 commit comments

Comments
 (0)