mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-11-26 01:00:27 +02:00
Optimize package getter (#4356)
Remove redundant truthy check for properties of icons in index.js We test if all icon scan be retrieved anyway, if any icon is missing these properties we would find out during testing.
This commit is contained in:
parent
f2dc528780
commit
f6bd00315a
@ -5,14 +5,12 @@ Object.defineProperty(icons, "get", {
|
|||||||
value: function(targetName) {
|
value: function(targetName) {
|
||||||
if (icons[targetName]) {
|
if (icons[targetName]) {
|
||||||
return icons[targetName];
|
return icons[targetName];
|
||||||
} else {
|
}
|
||||||
var normalizedName = targetName.toLowerCase();
|
var normalizedName = targetName.toLowerCase();
|
||||||
for (var iconName in icons) {
|
for (var iconName in icons) {
|
||||||
var icon = icons[iconName];
|
var icon = icons[iconName];
|
||||||
if ((icon.title && icon.title.toLowerCase() === normalizedName)
|
if (icon.title.toLowerCase() === normalizedName || icon.slug === normalizedName) {
|
||||||
|| (icon.slug && icon.slug === normalizedName)) {
|
return icon;
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user