Code coverage report for master/plugins/commentConvert.js

Statements: 100% (4 / 4)      Branches: 100% (0 / 0)      Functions: 100% (2 / 2)      Lines: 100% (4 / 4)      Ignored: none     

All files » master/plugins/ » commentConvert.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                  1               1 1 1        
/**
    @overview Demonstrate how to modify the source code before the parser sees it.
    @module plugins/commentConvert
    @author Michael Mathews <micmath@gmail.com>
 */
'use strict';
 
/*eslint spaced-line-comment: 0 */
 
exports.handlers = {
    ///
    /// Convert ///-style comments into jsdoc comments.
    /// @param e
    /// @param e.filename
    /// @param e.source
    ///
    beforeParse: function(e) {
        e.source = e.source.replace(/(\n[ \t]*\/\/\/[^\n]*)+/g, function($) {
            var replacement = '\n/**' + $.replace(/^[ \t]*\/\/\//mg, '').replace(/(\n$|$)/, '*/$1');
            return replacement;
        });
    }
};