All files / style9/src/utils ast.js

100% Statements 8/8
100% Branches 6/6
100% Functions 3/3
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  83x 83x 3x       18x   18x       16x     8x  
function evaluateNodePath(path) {
  const { value, confident, deopt } = path.evaluate();
  if (confident) return value;
  throw deopt.buildCodeFrameError('Could not evaluate value');
}
 
function isDynamicKey(memberExpr) {
  const property = memberExpr.get('property');
 
  return memberExpr.node.computed && !property.isLiteral();
}
 
function getStaticKey(memberExpr) {
  return memberExpr.node.property.name || memberExpr.node.property.value;
}
 
module.exports = { isDynamicKey, getStaticKey, evaluateNodePath };