[79a0317] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | Object.defineProperty(exports, "convertFunctionParams", {
|
---|
| 7 | enumerable: true,
|
---|
| 8 | get: function () {
|
---|
| 9 | return _params.default;
|
---|
| 10 | }
|
---|
| 11 | });
|
---|
| 12 | exports.default = void 0;
|
---|
| 13 | var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
---|
| 14 | var _params = require("./params.js");
|
---|
| 15 | var _rest = require("./rest.js");
|
---|
| 16 | var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
|
---|
| 17 | var _api$assumption, _api$assumption2;
|
---|
| 18 | api.assertVersion(7);
|
---|
| 19 | const ignoreFunctionLength = (_api$assumption = api.assumption("ignoreFunctionLength")) != null ? _api$assumption : options.loose;
|
---|
| 20 | const noNewArrows = (_api$assumption2 = api.assumption("noNewArrows")) != null ? _api$assumption2 : true;
|
---|
| 21 | return {
|
---|
| 22 | name: "transform-parameters",
|
---|
| 23 | visitor: {
|
---|
| 24 | Function(path) {
|
---|
| 25 | if (path.isArrowFunctionExpression() && path.get("params").some(param => param.isRestElement() || param.isAssignmentPattern())) {
|
---|
| 26 | path.arrowFunctionToExpression({
|
---|
| 27 | allowInsertArrowWithRest: false,
|
---|
| 28 | noNewArrows
|
---|
| 29 | });
|
---|
| 30 | if (!path.isFunctionExpression()) return;
|
---|
| 31 | }
|
---|
| 32 | const convertedRest = (0, _rest.default)(path);
|
---|
| 33 | const convertedParams = (0, _params.default)(path, ignoreFunctionLength);
|
---|
| 34 | if (convertedRest || convertedParams) {
|
---|
| 35 | path.scope.crawl();
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 | };
|
---|
| 40 | });
|
---|
| 41 |
|
---|
| 42 | //# sourceMappingURL=index.js.map
|
---|