]> Untitled Git - lemmy-ui.git/blob - src/shared/utils/app/get-comment-parent-id.ts
fix: Fix badge alignment and break out into component
[lemmy-ui.git] / src / shared / utils / app / get-comment-parent-id.ts
1 import { Comment } from "lemmy-js-client";
2
3 export default function getCommentParentId(
4   comment?: Comment
5 ): number | undefined {
6   const split = comment?.path.split(".");
7   // remove the 0
8   split?.shift();
9
10   return split && split.length > 1
11     ? Number(split.at(split.length - 2))
12     : undefined;
13 }