Code coverage report for lib/is_jsdoc_comment.js

Statements: 100% (3 / 3)      Branches: 100% (4 / 4)      Functions: 100% (1 / 1)      Lines: 100% (3 / 3)      Ignored: none     

All files » lib/ » is_jsdoc_comment.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                            36 569 569        
'use strict';
 
/**
 * 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-types node of the comment
 * @return {boolean} whether it is valid
 */
module.exports = function isJSDocComment(comment) {
  var asterisks = comment.value.match(/^(\*+)/);
  return (comment.type === 'CommentBlock' || // estree
    comment.type === 'Block') // get-comments / traditional
    && asterisks && asterisks[ 1 ].length === 1;
};