feat: allow creating articles with marka
This commit is contained in:
@@ -103,6 +103,12 @@ export function debounce<T extends (...args: Parameters<T>) => void>(
|
||||
|
||||
export function parseRating(rating: string | number) {
|
||||
if (typeof rating === "string") {
|
||||
try {
|
||||
return parseInt(rating);
|
||||
} catch (_e) {
|
||||
// This is okay
|
||||
}
|
||||
|
||||
return [...rating.matchAll(/⭐/g)].length;
|
||||
}
|
||||
return rating;
|
||||
|
||||
Reference in New Issue
Block a user