mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-11-16 00:59:07 +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) {
|
||||
if (icons[targetName]) {
|
||||
return icons[targetName];
|
||||
} else {
|
||||
var normalizedName = targetName.toLowerCase();
|
||||
for (var iconName in icons) {
|
||||
var icon = icons[iconName];
|
||||
if ((icon.title && icon.title.toLowerCase() === normalizedName)
|
||||
|| (icon.slug && icon.slug === normalizedName)) {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
var normalizedName = targetName.toLowerCase();
|
||||
for (var iconName in icons) {
|
||||
var icon = icons[iconName];
|
||||
if (icon.title.toLowerCase() === normalizedName || icon.slug === normalizedName) {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user