atword.js 528 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Container = require('./container');
  3. class AtWord extends Container {
  4. constructor (opts) {
  5. super(opts);
  6. this.type = 'atword';
  7. }
  8. toString () {
  9. let quote = this.quoted ? this.raws.quote : '';
  10. return [
  11. this.raws.before,
  12. '@',
  13. // we can't use String() here because it'll try using itself
  14. // as the constructor
  15. String.prototype.toString.call(this.value),
  16. this.raws.after
  17. ].join('');
  18. }
  19. }
  20. Container.registerWalker(AtWord);
  21. module.exports = AtWord;