UI for Zipcoin Blue

separator.js 775B

1234567891011121314151617181920212223242526272829303132333435
  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. var Separator = module.exports = function (line) {
  11. this.type = 'separator';
  12. this.line = chalk.dim(line || new Array(15).join(figures.line));
  13. };
  14. /**
  15. * Helper function returning false if object is a separator
  16. * @param {Object} obj object to test against
  17. * @return {Boolean} `false` if object is a separator
  18. */
  19. Separator.exclude = function (obj) {
  20. return obj.type !== 'separator';
  21. };
  22. /**
  23. * Stringify separator
  24. * @return {String} the separator display string
  25. */
  26. Separator.prototype.toString = function () {
  27. return this.line;
  28. };