Code coverage report for 6to5/transformation/transformers/use-strict.js

Statements: 100% (7 / 7)      Branches: 100% (6 / 6)      Functions: 100% (1 / 1)      Lines: 100% (7 / 7)      Ignored: none     

All files » 6to5/transformation/transformers/ » use-strict.js
1 2 3 4 5 6 7 8 9 10 11 12 131   1 302 302   302   302 301      
var t = require("../../types");
 
module.exports = function (ast) {
  var body = ast.program.body;
  var first = body[0];
 
  var noStrict = !first || !t.isExpressionStatement(first) || !t.isLiteral(first.expression) || first.expression.value !== "use strict";
 
  if (noStrict) {
    body.unshift(t.expressionStatement(t.literal("use strict")));
  }
};