Skip to content

Commit

Permalink
Optimize warning search
Browse files Browse the repository at this point in the history
  • Loading branch information
treyturner committed Jan 1, 2024
1 parent db9985f commit e002a80
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions sanitize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ async function sanitizeWarnings() {
const warnings: { text: string }[] = await api.getWarnings();
let clearedWarnings = false;
if (typeof warnings === 'object' && warnings.length) {
for (const warning of warnings) {
for (const category of config.categories) {
if (
warning.text.toLowerCase().includes(category) ||
warning.text.includes('Your UNRAR version is')
) {
clearedWarnings = true;
console.log(`${fmtTime()} Clearing warnings...`);
await api.clearAllWarnings();
}
}
if (
config.categories.some((category) =>
warnings.some(
(warning) =>
warning.text.toLowerCase().includes(category) ||
warning.text.includes('Your UNRAR version is')
)
)
) {
clearedWarnings = true;
console.log(`${fmtTime()} Clearing warnings...`);
await api.clearAllWarnings();
}
}
return clearedWarnings;
Expand Down

0 comments on commit e002a80

Please sign in to comment.