in src/utils/docblock.ts [22:47]
export function getDocblock(path: NodePath, trailing = false): string | null {
let comments: CommentKind[] = [];
if (trailing && path.node.trailingComments) {
comments = path.node.trailingComments.filter(
comment =>
comment.type === 'CommentBlock' && DOCBLOCK_HEADER.test(comment.value),
);
} else if (path.node.leadingComments) {
comments = path.node.leadingComments.filter(
comment =>
comment.type === 'CommentBlock' && DOCBLOCK_HEADER.test(comment.value),
);
} else if (path.node.comments) {
comments = path.node.comments.filter(
comment =>
comment.leading &&
comment.type === 'CommentBlock' &&
DOCBLOCK_HEADER.test(comment.value),
);
}
if (comments.length > 0) {
return parseDocblock(comments[comments.length - 1].value);
}
return null;
}