airship-server
Version:
Airship is a framework for Node.JS & TypeScript that helps you to write big, scalable and maintainable API servers.
30 lines • 752 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const CodeLine_1 = require("./CodeLine");
class SourceCode {
constructor(lines = []) {
this._lines = lines;
}
add(data, tab = 0) {
this._lines.push(new CodeLine_1.default(data, tab));
return this;
}
append(code, tab = 0) {
code.tab(tab);
this._lines.push(...code.lines);
}
render() {
return this._lines.map(line => line.data).join('\n');
}
tab(n) {
this._lines.forEach(line => line.tab(n));
}
get lines() {
return this._lines;
}
genTab(n) {
return new Array(n).join(' ');
}
}
exports.default = SourceCode;
//# sourceMappingURL=SourceCode.js.map