Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

separator.js 779B

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict';
  2. var chalk = require('chalk');
  3. var figures = require('figures');
  4. /**
  5. * Separator object
  6. * Used to space/separate choices group
  7. * @constructor
  8. * @param {String} line Separation line content (facultative)
  9. */
  10. class Separator {
  11. constructor(line) {
  12. this.type = 'separator';
  13. this.line = chalk.dim(line || new Array(15).join(figures.line));
  14. }
  15. /**
  16. * Stringify separator
  17. * @return {String} the separator display string
  18. */
  19. toString() {
  20. return this.line;
  21. }
  22. }
  23. /**
  24. * Helper function returning false if object is a separator
  25. * @param {Object} obj object to test against
  26. * @return {Boolean} `false` if object is a separator
  27. */
  28. Separator.exclude = function(obj) {
  29. return obj.type !== 'separator';
  30. };
  31. module.exports = Separator;