index.js 1.0 KB

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.output = exports.resetOutput = exports.formatWarnMsg = exports.formatInfoMsg = exports.formatErrMsg = void 0;
  4. var format_1 = require("./format");
  5. Object.defineProperty(exports, "formatErrMsg", { enumerable: true, get: function () { return format_1.formatErrMsg; } });
  6. Object.defineProperty(exports, "formatInfoMsg", { enumerable: true, get: function () { return format_1.formatInfoMsg; } });
  7. Object.defineProperty(exports, "formatWarnMsg", { enumerable: true, get: function () { return format_1.formatWarnMsg; } });
  8. let lastType;
  9. let lastMsg;
  10. function resetOutput(type) {
  11. if (type === lastType) {
  12. lastType = undefined;
  13. lastMsg = '';
  14. }
  15. }
  16. exports.resetOutput = resetOutput;
  17. function output(type, msg) {
  18. if (type === lastType && msg === lastMsg) {
  19. return;
  20. }
  21. lastMsg = msg;
  22. lastType = type;
  23. const method = type === 'info' ? 'log' : type;
  24. console[method](msg);
  25. }
  26. exports.output = output;