refactor: moving the targetCategory string generation out of the filter

This commit is contained in:
Yiwei Ho 2024-04-14 08:50:07 +08:00
parent 88ba73ba9d
commit 24e9c827ca

View File

@ -58,9 +58,8 @@ export const GET = async ({ url, request }: RequestEvent) => {
const category = getCategoryParams;
if (category) {
const targetCategory = category.charAt(0).toUpperCase() + category.slice(1);
const categorySvgs = fullRouteSvgsData.filter((svg) => {
const targetCategory = category.charAt(0).toUpperCase() + category.slice(1);
if (typeof svg.category === 'string') {
return svg.category === targetCategory;
}