mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-05-18 14:20:21 +00:00
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m18s
9 lines
278 B
TypeScript
9 lines
278 B
TypeScript
import type {Comment} from '@/types'
|
|
|
|
export function getCommentCount(comments: Comment[]) {
|
|
return comments.reduce((acc, comment) => {
|
|
if (!comment) return acc
|
|
const replyCount = comment.replies?.length || 0
|
|
return (acc + 1) + replyCount
|
|
}, 0)
|
|
} |