code: function evaluateIdentifier(path) {
    if (!path.isReferencedIdentifier()) {
      throw new Error(`Expected ReferencedIdentifier. Got ${path.type}`);
    }
  
    const { node } = path;
  
    const binding = path.scope.getBinding(node.name);
  
    if (!binding) {
      const { name } = node;
      if (!name) {
        return deopt(path);
      }
  
      switch (name) {
        case "undefined":
          return { confident: true, value: undefined };
        case "NaN":
          return { confident: true, value: NaN };
        case "Infinity":
          return { confident: true, value: Infinity };
        default:
          return deopt(path);
      }
    }
  
    if (binding.constantViolations.length > 0) {
      return deopt(binding.path);
    }
  
    // referenced in a different scope - deopt
    if (shouldDeoptBasedOnScope(binding, path)) {
      return deopt(path);
    }
  
    // let/var/const referenced before init
    // or "var" referenced in an outer scope
    const flowEvalResult = evaluateBasedOnControlFlow(binding, path);
  
    if (flowEvalResult.confident) {
      return flowEvalResult;
    }
  
    if (flowEvalResult.shouldDeopt) {
      return deopt(path);
    }
  
    return path.evaluate();
  }
docs: Original Source: https://github.com/babel/babel/blob/master/packages/babel-traverse/src/path/evaluation.js modified for Babel-minify use