mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
BREAKING CHANGE: I'd like to still support C++ and other languages in the future! But I'm much happier doing so by separating the extraction & input phases to the degree that documentation.js can read the output of another module that extracts JSDoc comments from C++ code, rather than having CPP support in it. Fixes #850. Fixes #731. Fixes #702. Fixes #132.
26 lines
697 B
JavaScript
26 lines
697 B
JavaScript
/* @flow */
|
|
|
|
/**
|
|
* Detect whether a comment is a JSDoc comment: it must be a block
|
|
* comment which starts with two asterisks, not any other number of asterisks.
|
|
*
|
|
* The code parser automatically strips out the first asterisk that's
|
|
* required for the comment to be a comment at all, so we count the remaining
|
|
* comments.
|
|
*
|
|
* @name isJSDocComment
|
|
* @param {Object} comment an ast path of the comment
|
|
* @return {boolean} whether it is valid
|
|
*/
|
|
module.exports = function isJSDocComment(
|
|
comment /*: {
|
|
value: string,
|
|
type: string
|
|
}*/
|
|
) {
|
|
var asterisks = comment.value.match(/^(\*+)/);
|
|
return (
|
|
comment.type === 'CommentBlock' && asterisks && asterisks[1].length === 1
|
|
);
|
|
};
|