index.js 761 B

12345678910111213141516171819202122232425262728293031
  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 _default = (0, _helperPluginUtils.declare)((api, options) => {
  8. var _api$assumption;
  9. api.assertVersion(7);
  10. const noNewArrows = (_api$assumption = api.assumption("noNewArrows")) != null ? _api$assumption : !options.spec;
  11. return {
  12. name: "transform-arrow-functions",
  13. visitor: {
  14. ArrowFunctionExpression(path) {
  15. if (!path.isArrowFunctionExpression()) return;
  16. path.arrowFunctionToExpression({
  17. allowInsertArrow: false,
  18. noNewArrows,
  19. specCompliant: !noNewArrows
  20. });
  21. }
  22. }
  23. };
  24. });
  25. exports.default = _default;