lib/module-analyser.js
function findExports( ast ) {
    try {
        const
            publics = {},
            privates = {},
            body = ast.program.body[ 0 ].expression.arguments[ 1 ].body.body;

        body.forEach( function ( item ) {
            if ( parseExports( item, publics ) ) return;
            if ( parseModuleExports( item, publics ) ) return;
            parseFunctionDeclaration( item, privates );
        } );

        const output = [];
        Object.keys( publics ).forEach( function ( exportName ) {
            const
                exportValue = publics[ exportName ],
                target = privates[ exportValue.target ];
            if ( target ) {
                exportValue.comments = exportValue.comments || target.comments;
                exportValue.type = target.type;
                exportValue.params = target.params;
            }
            output.push( {
                id: exportName,
                type: exportValue.type,
                params: exportValue.params,
                comments: exportValue.comments
            } );
        } );

        return output;
    } catch ( ex ) {
        throw new Error( `${ex}\n...in module-analyser/findExports()` );
    }
}
function findExports( ast ) {
    try {
        const
            publics = {},
            privates = {},
            body = ast.program.body[ 0 ].expression.arguments[ 1 ].body.body;

        body.forEach( function ( item ) {
            if ( parseExports( item, publics ) ) return;
            if ( parseModuleExports( item, publics ) ) return;
            parseFunctionDeclaration( item, privates );
        } );

        const output = [];
        Object.keys( publics ).forEach( function ( exportName ) {
            const
                exportValue = publics[ exportName ],
                target = privates[ exportValue.target ];
            if ( target ) {
                exportValue.comments = exportValue.comments || target.comments;
                exportValue.type = target.type;
                exportValue.params = target.params;
            }
            output.push( {
                id: exportName,
                type: exportValue.type,
                params: exportValue.params,
                comments: exportValue.comments
            } );
        } );

        return output;
    } catch ( ex ) {
        throw new Error( `${ex}\n...in module-analyser/findExports()` );
    }
}
function findExports ( ast ) { try { const publics = { } , privates = { } , body = ast . program . body [ 0 ] . expression . arguments [ 1 ] . body . body ; body . forEach ( function ( item ) { if ( parseExports ( item , publics ) ) return ; if ( parseModuleExports ( item , publics ) ) return ; parseFunctionDeclaration ( item , privates ) ; } ) ; const output = [ ] ; Object . keys ( publics ) . forEach ( function ( exportName ) { const exportValue = publics [ exportName ] , target = privates [ exportValue . target ] ; if ( target ) { exportValue . comments = exportValue . comments || target . comments ; exportValue . type = target . type ; exportValue . params = target . params ; } output . push ( { id : exportName , type : exportValue . type , params : exportValue . params , comments : exportValue . comments } ) ; } ) ; return output ; } catch ( ex ) { throw new Error ( ` ${ ex } \n ` ) ; } }
Look for the exports of the module with their comments.
This will be used for documentation.
@param {object} ast - AST of the module.
@returns {array} `{ id, type, comments }`
Look for the exports of the module with their comments . This will be used for documentation .