utils/ExclusionUtils.js
function parseASTComments(astNode) {
    var comments = [];
    if(astNode && astNode.leadingComments) {
        _.forEach(astNode.leadingComments, function(comment) {
            if(comment.type === 'Block') {
                comments = comments.concat(comment.value.split('\n').map(function(commentLine) {
                    // Remove asterisks at the start of the line
                    return commentLine.replace(/^\s*\*\s*/g, '').trim();
                }));
            } else {
                comments.push(comment.value);
            }
        });
    }

    return comments;
}
function parseASTComments(astNode) {
    var comments = [];
    if(astNode && astNode.leadingComments) {
        _.forEach(astNode.leadingComments, function(comment) {
            if(comment.type === 'Block') {
                comments = comments.concat(comment.value.split('\n').map(function(commentLine) {
                    // Remove asterisks at the start of the line
                    return commentLine.replace(/^\s*\*\s*/g, '').trim();
                }));
            } else {
                comments.push(comment.value);
            }
        });
    }

    return comments;
}
function parseASTComments ( astNode ) { var comments = [ ] ; if ( astNode && astNode . leadingComments ) { _ . forEach ( astNode . leadingComments , function ( comment ) { if ( comment . type === 'Block' ) { comments = comments . concat ( comment . value . split ( '\n' ) . map ( function ( commentLine ) { // Remove asterisks at the start of the line return commentLine . replace ( / ^\s*\*\s* / g , '' ) . trim ( ) ; } ) ) ; } else { comments . push ( comment . value ) ; } } ) ; } return comments ; }
Parse the comments from a given astNode. It removes all leading asterisks from multiline comments, as
well as all leading and trailing whitespace.
@param {object} astNode the AST node from which comments should be retrieved
@returns {[string]} the comments for the AST node, or an empty array if none could be found
Parse the comments from a given astNode . It removes all leading asterisks from multiline comments as well as all leading and trailing whitespace .