all files / dist/writers/ DocumentationedWriter.js

100% Statements 21/21
100% Branches 8/8
100% Functions 5/5
100% Lines 21/21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  24×   47× 41×                
"use strict";
var DocumentationedWriter = (function () {
    function DocumentationedWriter(writer) {
        this.writer = writer;
    }
    DocumentationedWriter.prototype.write = function (def) {
        if (def.documentationComment == null || /^[\s]*$/.test(def.documentationComment))
            return;
        if (!/^\s*\/\*\*[\s\S]*\*\//.test(def.documentationComment))
            this.writeWithComment(def.documentationComment);
        else
            this.writer.write(def.documentationComment);
        this.writer.newLine();
    };
    DocumentationedWriter.prototype.writeWithComment = function (text) {
        var _this = this;
        this.writer.writeLine("/**");
        text.split(/\r?\n/).forEach(function (line) {
            _this.writer.write(" *");
            if (line.length > 0)
                _this.writer.write(" ");
            _this.writer.write(line).newLine();
        });
        this.writer.write(" */");
    };
    return DocumentationedWriter;
}());
exports.DocumentationedWriter = DocumentationedWriter;
 
//# sourceMappingURL=DocumentationedWriter.js.map