Code coverage report for 6to5/lib/6to5/generation/generators/template-literals.js

Statements: 100% (18 / 18)      Branches: 100% (2 / 2)      Functions: 100% (4 / 4)      Lines: 100% (18 / 18)      Ignored: none     

All files » 6to5/lib/6to5/generation/generators/ » template-literals.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 311   1 6 6     1 25     1 17   17 17 17   17 25   25 8 8 8       17    
var _ = require("lodash");
 
exports.TaggedTemplateExpression = function (node, print) {
  print(node.tag);
  print(node.quasi);
};
 
exports.TemplateElement = function (node) {
  this._push(node.value.raw);
};
 
exports.TemplateLiteral = function (node, print) {
  this.push("`");
 
  var quasis = node.quasis;
  var self   = this;
  var len    = quasis.length;
 
  _.each(quasis, function (quasi, i) {
    print(quasi);
 
    if (i + 1 < len) {
      self.push("${ ");
      print(node.expressions[i]);
      self.push(" }");
    }
  });
 
  this._push("`");
};