UNPKG

371 BJavaScriptView Raw
1'use strict';
2
3function StringWriter (config) {
4 this.lines = [];
5 this.lineSeparator = config.lineSeparator;
6}
7
8StringWriter.prototype.write = function (str) {
9 this.lines.push(str);
10};
11
12StringWriter.prototype.flush = function () {
13 var str = this.lines.join(this.lineSeparator);
14 this.lines.length = 0;
15 return str;
16};
17
18module.exports = StringWriter;