Code coverage report for 6to5/lib/6to5/transformation/transformers/spec-property-literals.js

Statements: 100% (8 / 8)      Branches: 100% (9 / 9)      Functions: 100% (1 / 1)      Lines: 100% (8 / 8)      Ignored: none     

All files » 6to5/lib/6to5/transformation/transformers/ » spec-property-literals.js
1 2 3 4 5 6 7 8 9 10 11 12 13 141   1 14618 14618   375 375 14243   192      
var t = require("../../types");
 
exports.Property = function (node) {
  var key = node.key;
  if (t.isLiteral(key) && t.isValidIdentifier(key.value)) {
    // property key is a literal but a valid identifier
    node.key = t.identifier(key.value);
    node.computed = false;
  } else if (!node.computed && t.isIdentifier(key) && !t.isValidIdentifier(key.name)) {
    // property key is a keyword
    node.key = t.literal(key.name);
  }
};