Files
5chan/src/lib/utils/comment-moderation-utils.ts
T

16 lines
400 B
TypeScript
Raw Normal View History

type MaybeArchivedComment = {
archived?: boolean;
commentModeration?: {
archived?: boolean;
};
};
export const isCommentArchived = (comment: unknown): boolean => {
if (!comment || typeof comment !== 'object') {
return false;
}
const archivedComment = comment as MaybeArchivedComment;
return Boolean(archivedComment.archived || archivedComment.commentModeration?.archived);
};