lib/parser.js
function sortComments(comments) {
    var moduleComments = [];
    var typeComments = [];
    var varComments = [];
    var methodComments = [];
    var typelessComments = [];

    comments.forEach(function (comment) {
        if(comment.type) {
            switch(comment.type) {
                case exports.COMMENT_TYPES.MODULE:
                    moduleComments.push(comment);
                    break;
                case exports.COMMENT_TYPES.METHOD:
                    methodComments.push(comment);
                    break;
                case exports.COMMENT_TYPES.TYPE:
                    typeComments.push(comment);
                    break;
                case exports.COMMENT_TYPES.VARIABLE:
                    varComments.push(comment);
                    break;
            }
        } else {
            typelessComments.push(comment);
        }
    });

    return moduleComments.concat(typeComments.concat(varComments.concat(methodComments.concat(typelessComments))));
}
function sortComments(comments) {
    var moduleComments = [];
    var typeComments = [];
    var varComments = [];
    var methodComments = [];
    var typelessComments = [];

    comments.forEach(function (comment) {
        if(comment.type) {
            switch(comment.type) {
                case exports.COMMENT_TYPES.MODULE:
                    moduleComments.push(comment);
                    break;
                case exports.COMMENT_TYPES.METHOD:
                    methodComments.push(comment);
                    break;
                case exports.COMMENT_TYPES.TYPE:
                    typeComments.push(comment);
                    break;
                case exports.COMMENT_TYPES.VARIABLE:
                    varComments.push(comment);
                    break;
            }
        } else {
            typelessComments.push(comment);
        }
    });

    return moduleComments.concat(typeComments.concat(varComments.concat(methodComments.concat(typelessComments))));
}
function sortComments ( comments ) { var moduleComments = [ ] ; var typeComments = [ ] ; var varComments = [ ] ; var methodComments = [ ] ; var typelessComments = [ ] ; comments . forEach ( function ( comment ) { if ( comment . type ) { switch ( comment . type ) { case exports . COMMENT_TYPES . MODULE : moduleComments . push ( comment ) ; break ; case exports . COMMENT_TYPES . METHOD : methodComments . push ( comment ) ; break ; case exports . COMMENT_TYPES . TYPE : typeComments . push ( comment ) ; break ; case exports . COMMENT_TYPES . VARIABLE : varComments . push ( comment ) ; break ; } } else { typelessComments . push ( comment ) ; } } ) ; return moduleComments . concat ( typeComments . concat ( varComments . concat ( methodComments . concat ( typelessComments ) ) ) ) ; }
Sort mapped reduced comments. Module comments first followed by class, variables and methods.
@param {Comment[]} comments an array of mapped-reduced comments
@return {Comment[]} sorted comments array
@private
Sort mapped reduced comments . Module comments first followed by class variables and methods .