code.js 617 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var Node = require('./node');
  3. /**
  4. * Initialize a `Code` node with the given code `val`.
  5. * Code may also be optionally buffered and escaped.
  6. *
  7. * @param {String} val
  8. * @param {Boolean} buffer
  9. * @param {Boolean} escape
  10. * @api public
  11. */
  12. var Code = module.exports = function Code(val, buffer, escape) {
  13. this.val = val;
  14. this.buffer = buffer;
  15. this.escape = escape;
  16. if (val.match(/^ *else/)) this.debug = false;
  17. };
  18. // Inherit from `Node`.
  19. Code.prototype = Object.create(Node.prototype);
  20. Code.prototype.constructor = Code;
  21. Code.prototype.type = 'Code'; // prevent the minifiers removing this