mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
20 lines
351 B
JavaScript
20 lines
351 B
JavaScript
function countLinks(comment) {
|
|
let linkCount = 0;
|
|
|
|
if (comment.replyCount > 0) {
|
|
for (let reply of comment.replies.pages.topAll.comments) {
|
|
|
|
if (reply.link) {
|
|
linkCount++;
|
|
}
|
|
|
|
if (reply.replyCount > 0) {
|
|
linkCount += countLinks(reply);
|
|
}
|
|
}
|
|
}
|
|
|
|
return linkCount;
|
|
}
|
|
|
|
export default countLinks; |