feat: sort by rating by default

This commit is contained in:
2023-08-29 13:48:52 +02:00
parent 78b1699152
commit 517b1ba23d
3 changed files with 35 additions and 15 deletions

View File

@@ -88,3 +88,10 @@ export function debounce<T extends (...args: Parameters<T>) => void>(
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
export function parseRating(rating: string | number) {
if (typeof rating === "string") {
return [...rating.matchAll(/⭐/)].length;
}
return rating;
}