text.js 414 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var Node = require('./node');
  3. /**
  4. * Initialize a `Text` node with optional `line`.
  5. *
  6. * @param {String} line
  7. * @api public
  8. */
  9. var Text = module.exports = function Text(line) {
  10. this.val = line;
  11. };
  12. // Inherit from `Node`.
  13. Text.prototype = Object.create(Node.prototype);
  14. Text.prototype.constructor = Text;
  15. Text.prototype.type = 'Text';
  16. /**
  17. * Flag as text.
  18. */
  19. Text.prototype.isText = true;