Skip to content

Commit

Permalink
fix: types and edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Joabesv committed Dec 12, 2024
1 parent 049ea6f commit 51bd1a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/scripts/sig/classes-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ export function scrapeClassesPage(page: string) {
name: normalizedName.trim().toLocaleLowerCase(),
credits: extractCredits(normalizedProvisionPeriod),
};
});
}).filter(component => component !== null);
}
3 changes: 2 additions & 1 deletion src/scripts/sig/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ function extractComponents(

const matchComponent = classesData.find((c) => c.name === component.name);

return { ...component, credits: matchComponent?.credits };
// 0 here should not happen, but hey you never know!
return { ...component, credits: matchComponent?.credits ?? 0 };
});

return components;
Expand Down

0 comments on commit 51bd1a1

Please sign in to comment.