Code coverage report for 6to5/transformation/transformers/es6-modules.js

Statements: 87.1% (27 / 31)      Branches: 77.78% (14 / 18)      Functions: 100% (3 / 3)      Lines: 100% (27 / 27)      Ignored: none     

All files » 6to5/transformation/transformers/ » es6-modules.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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 511   1 264 208       1 95   95 65 65 80     30 30     95   95     1 169   169     109 49 49     109 109   60 60 80       169   169    
var t = require("../../types");
 
var inheritsComments = function (node, nodes) {
  if (nodes.length) {
    t.inheritsComments(nodes[0], node);
  }
};
 
exports.ImportDeclaration = function (node, parent, file) {
  var nodes = [];
 
  if (node.specifiers.length) {
    Iif (!file.moduleFormatter.importSpecifier) return;
    for (var i in node.specifiers) {
      file.moduleFormatter.importSpecifier(node.specifiers[i], node, nodes, parent);
    }
  } else {
    Iif (!file.moduleFormatter.importDeclaration) return;
    file.moduleFormatter.importDeclaration(node, nodes, parent);
  }
 
  inheritsComments(node, nodes);
 
  return nodes;
};
 
exports.ExportDeclaration = function (node, parent, file) {
  var nodes = [];
 
  if (node.declaration) {
    // make sure variable exports have an initialiser
    // this is done here to avoid duplicating it in the module formatters
    if (t.isVariableDeclaration(node.declaration)) {
      var declar = node.declaration.declarations[0];
      declar.init = declar.init || t.identifier("undefined");
    }
 
    Iif (!file.moduleFormatter.exportDeclaration) return;
    file.moduleFormatter.exportDeclaration(node, nodes, parent);
  } else {
    Iif (!file.moduleFormatter.exportSpecifier) return;
    for (var i in node.specifiers) {
      file.moduleFormatter.exportSpecifier(node.specifiers[i], node, nodes, parent);
    }
  }
 
  inheritsComments(node, nodes);
 
  return nodes;
};