index.js
function extractJsdoc(comment) {
    var docAst = doctrine.parse(comment, { unwrap: true, sloppy: true });
    if (!docAst.tags || docAst.tags.length === 0) {
        return null;
    }
    // only interested in @param @property, and @return
    var paramTags = docAst.tags.filter(function(tag) {
        return tag.title === "param";
    }).map(jsdocTagToFlowTag);

    var returnTags = docAst.tags.filter(function(tag) {
        return tag.title === "return" || tag.title === "returns";
    }).map(jsdocTagToFlowTag);

    var propTags = docAst.tags.filter(function(tag) {
        return tag.title === "property" || tag.title === "prop";
    }).map(jsdocTagToFlowTag);

    return {
        params: paramTags,
        returns: returnTags,
        props: propTags
    };
}
function extractJsdoc(comment) {
    var docAst = doctrine.parse(comment, { unwrap: true, sloppy: true });
    if (!docAst.tags || docAst.tags.length === 0) {
        return null;
    }
    // only interested in @param @property, and @return
    var paramTags = docAst.tags.filter(function(tag) {
        return tag.title === "param";
    }).map(jsdocTagToFlowTag);

    var returnTags = docAst.tags.filter(function(tag) {
        return tag.title === "return" || tag.title === "returns";
    }).map(jsdocTagToFlowTag);

    var propTags = docAst.tags.filter(function(tag) {
        return tag.title === "property" || tag.title === "prop";
    }).map(jsdocTagToFlowTag);

    return {
        params: paramTags,
        returns: returnTags,
        props: propTags
    };
}
function extractJsdoc ( comment ) { var docAst = doctrine . parse ( comment , { unwrap : true , sloppy : true } ) ; if ( ! docAst . tags || docAst . tags . length === 0 ) { return null ; } // only interested in @param @property, and @return var paramTags = docAst . tags . filter ( function ( tag ) { return tag . title === "param" ; } ) . map ( jsdocTagToFlowTag ) ; var returnTags = docAst . tags . filter ( function ( tag ) { return tag . title === "return" || tag . title === "returns" ; } ) . map ( jsdocTagToFlowTag ) ; var propTags = docAst . tags . filter ( function ( tag ) { return tag . title === "property" || tag . title === "prop" ; } ) . map ( jsdocTagToFlowTag ) ; return { params : paramTags , returns : returnTags , props : propTags } ; }
Extract formatted JSDoc from a comment.
@param {String} comment The comment which may have JSDoc in it.
@return {Object} With 'params' and 'return' arrays which have 'loc', 'name'
and 'type' elements.
Extract formatted JSDoc from a comment .