统一甲屿云命名体系

This commit is contained in:
2026-06-29 23:26:43 +08:00
parent 48c47fe3ff
commit bc8a7d8d4c
1268 changed files with 3477 additions and 3511 deletions
@@ -0,0 +1,12 @@
export const normalizeCommentRating = (value: unknown, fallback = 5) => {
const numeric = Number(value ?? fallback)
if (!Number.isFinite(numeric)) {
return fallback
}
return Math.min(5, Math.max(1, Math.round(numeric)))
}
export const buildRatingStars = (rating: unknown) => {
const normalized = normalizeCommentRating(rating)
return Array.from({ length: 5 }, (_, index) => index < normalized)
}