thematic-break.js 576 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var repeat = require('repeat-string');
  3. module.exports = thematic;
  4. /* Stringify a `thematic-break`.
  5. * The character used is configurable through `rule`: (`'_'`)
  6. *
  7. * ___
  8. *
  9. * The number of repititions is defined through
  10. * `ruleRepetition`: (`6`)
  11. *
  12. * ******
  13. *
  14. * Whether spaces delimit each character, is configured
  15. * through `ruleSpaces`: (`true`)
  16. *
  17. * * * *
  18. */
  19. function thematic() {
  20. var options = this.options;
  21. var rule = repeat(options.rule, options.ruleRepetition);
  22. return options.ruleSpaces ? rule.split('').join(' ') : rule;
  23. }