21 lines
482 B
JavaScript
21 lines
482 B
JavaScript
import { declare } from "@babel/helper-plugin-utils";
|
|
import build from "@babel/helper-builder-binary-assignment-operator-visitor";
|
|
import { types as t } from "@babel/core";
|
|
|
|
export default declare(api => {
|
|
api.assertVersion(7);
|
|
|
|
return {
|
|
visitor: build({
|
|
operator: "**",
|
|
|
|
build(left, right) {
|
|
return t.callExpression(
|
|
t.memberExpression(t.identifier("Math"), t.identifier("pow")),
|
|
[left, right],
|
|
);
|
|
},
|
|
}),
|
|
};
|
|
});
|