UNPKG

corde

Version:

A simple library for Discord bot tests

62 lines (46 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true, }); exports.LogUpdate = void 0; const tslib_1 = require("tslib"); const log_update_1 = (0, tslib_1.__importDefault)(require("log-update")); class LogUpdate { constructor() { this._logValue = []; this._stdout = ""; } get stdout() { return this._stdout; } append(value) { const newLength = this._logValue.push(value); this.print(); return newLength - 1; } appendLine(value) { return this.append("\n" + value); } update(index, newValue) { if (index < 0 || index > this._logValue.length - 1) { return; } this._logValue[index] = newValue; this.print(); } updateLine(index, newValue) { this.update(index, "\n" + newValue); } persist() { log_update_1.default.done(); this._stdout += this.getlogValueString(); this._logValue = []; } getlogValueString() { return this._logValue.join(""); } print() { (0, log_update_1.default)(this.getlogValueString()); } } exports.LogUpdate = LogUpdate;