init project

This commit is contained in:
Christoph Brandau
2025-01-07 10:22:59 +01:00
commit 09d1685aa9
15 changed files with 470 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatCdlFile = formatCdlFile;
function formatCdlFile(content) {
let indentLevel = 0;
const formattedLines = [];
for (const line of content.split("\n")) {
const strippedLine = line.trim();
if (strippedLine.endsWith("}")) {
indentLevel = Math.max(indentLevel - 1, 0);
}
formattedLines.push(" ".repeat(indentLevel) + strippedLine);
if (strippedLine.endsWith("{")) {
indentLevel += 1;
}
}
return formattedLines.join("\n");
}