UNPKG

@mann-conomy/vdf-utils

Version:

A Node.js utility library for parsing and converting objects in Valve's Data File (VDF) format.

29 lines 926 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const enums_1 = require("../resources/enums"); class VdfBuilder { constructor(indentation) { this.lines = []; this.indentation = indentation; this.separator = enums_1.StringSeparator.Empty; } getIndentationLevel() { return "\t".repeat(this.indentation); } newline(key, value, nested) { const indent = this.getIndentationLevel(); let line = null; if (nested) { line = [indent, "\"", key, "\"\n", indent, "{\n", value, indent, "}\n"].join(this.separator); } else { line = [indent, "\"", key, "\"", "\t", "\t", "\"", value, "\"\n"].join(this.separator); } this.lines.push(line); } toVdf() { return this.lines.join(this.separator); } } exports.default = VdfBuilder; //# sourceMappingURL=builder.js.map