You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
918 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _helperPluginUtils = require("@babel/helper-plugin-utils");
  7. var _helperBuilderBinaryAssignmentOperatorVisitor = _interopRequireDefault(require("@babel/helper-builder-binary-assignment-operator-visitor"));
  8. var _core = require("@babel/core");
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. var _default = (0, _helperPluginUtils.declare)(api => {
  11. api.assertVersion(7);
  12. return {
  13. name: "transform-exponentiation-operator",
  14. visitor: (0, _helperBuilderBinaryAssignmentOperatorVisitor.default)({
  15. operator: "**",
  16. build(left, right) {
  17. return _core.types.callExpression(_core.types.memberExpression(_core.types.identifier("Math"), _core.types.identifier("pow")), [left, right]);
  18. }
  19. })
  20. };
  21. });
  22. exports.default = _default;