comment.js 490 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Container = require('./container');
  3. const Node = require('./node');
  4. class Comment extends Node {
  5. constructor (opts) {
  6. super(opts);
  7. this.type = 'comment';
  8. this.inline = Object(opts).inline || false;
  9. }
  10. toString () {
  11. return [
  12. this.raws.before,
  13. this.inline ? '//' : '/*',
  14. String(this.value),
  15. this.inline ? '' : '*/',
  16. this.raws.after
  17. ].join('');
  18. }
  19. };
  20. Container.registerWalker(Comment);
  21. module.exports = Comment;