block.js 306 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. class Block {
  3. constructor() {
  4. this.html = [];
  5. }
  6. toString() {
  7. return this.html.join('\n');
  8. }
  9. append(more) {
  10. this.html.push(more);
  11. }
  12. prepend(more) {
  13. this.html.unshift(more);
  14. }
  15. replace(instead) {
  16. this.html = [ instead ];
  17. }
  18. }
  19. module.exports = Block;