FormatterFactory.js 784 B

12345678910111213141516171819202122
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var CodeframeFormatter_1 = require("./CodeframeFormatter");
  4. var DefaultFormatter_1 = require("./DefaultFormatter");
  5. function createFormatter(type, options) {
  6. if (typeof type === 'function') {
  7. return type;
  8. }
  9. switch (type) {
  10. case 'codeframe':
  11. return CodeframeFormatter_1.createCodeframeFormatter(options);
  12. case 'default':
  13. case undefined:
  14. return DefaultFormatter_1.createDefaultFormatter();
  15. default:
  16. throw new Error('Unknown "' +
  17. type +
  18. '" formatter. Available types are: default, codeframe.');
  19. }
  20. }
  21. exports.createFormatter = createFormatter;
  22. //# sourceMappingURL=FormatterFactory.js.map