@hayspec/reporter
Version:
Reporter for Hayspec framework.
49 lines • 1.58 kB
JavaScript
;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Printer = void 0;
var chalk = require("chalk");
var Printer = (function () {
function Printer(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.mute, mute = _c === void 0 ? false : _c;
this.muted = mute;
}
Printer.prototype.mute = function () {
this.muted = true;
};
Printer.prototype.unmute = function () {
this.muted = false;
};
Printer.prototype.write = function () {
var input = [];
for (var _i = 0; _i < arguments.length; _i++) {
input[_i] = arguments[_i];
}
if (!this.muted) {
process.stdout.write(input.join(''));
}
};
Printer.prototype.end = function () {
var input = [];
for (var _i = 0; _i < arguments.length; _i++) {
input[_i] = arguments[_i];
}
if (!this.muted) {
this.write.apply(this, __spreadArray(__spreadArray([], input), ['\n\r']));
}
};
Printer.prototype.colorize = function (color, text) {
return chalk[color]("" + text);
};
Printer.prototype.indent = function (times, text) {
if (times === void 0) { times = 1; }
return "" + Array(times * 3).join(' ') + text;
};
return Printer;
}());
exports.Printer = Printer;
//# sourceMappingURL=printer.js.map