constants.js 709 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.Priority = void 0;
  6. const codes = {
  7. UNKNOWN: 0,
  8. VERBOSE: 1,
  9. DEBUG: 2,
  10. INFO: 3,
  11. WARN: 4,
  12. ERROR: 5,
  13. FATAL: 6,
  14. SILENT: 7
  15. };
  16. const Priority = { ...codes,
  17. fromName(name) {
  18. const value = codes[name.toUpperCase()];
  19. return value ? value : 0;
  20. },
  21. toName(code) {
  22. return Object.keys(codes).find(key => codes[key] === code) || 'UNKNOWN';
  23. },
  24. fromLetter(letter) {
  25. return codes[Object.keys(codes).find(key => key[0] === letter.toUpperCase()) || 'UNKNOWN'];
  26. },
  27. toLetter(code) {
  28. return Priority.toName(code)[0];
  29. }
  30. };
  31. exports.Priority = Priority;
  32. //# sourceMappingURL=constants.js.map