Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
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 |
|
---|
14 | var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
---|
15 |
|
---|
16 | var _params = require("./params");
|
---|
17 |
|
---|
18 | var _rest = require("./rest");
|
---|
19 |
|
---|
20 | var _default = (0, _helperPluginUtils.declare)((api, options) => {
|
---|
21 | var _api$assumption;
|
---|
22 |
|
---|
23 | api.assertVersion(7);
|
---|
24 | const ignoreFunctionLength = (_api$assumption = api.assumption("ignoreFunctionLength")) != null ? _api$assumption : options.loose;
|
---|
25 | const noNewArrows = api.assumption("noNewArrows");
|
---|
26 | return {
|
---|
27 | name: "transform-parameters",
|
---|
28 | visitor: {
|
---|
29 | Function(path) {
|
---|
30 | if (path.isArrowFunctionExpression() && path.get("params").some(param => param.isRestElement() || param.isAssignmentPattern())) {
|
---|
31 | path.arrowFunctionToExpression({
|
---|
32 | noNewArrows
|
---|
33 | });
|
---|
34 | }
|
---|
35 |
|
---|
36 | const convertedRest = (0, _rest.default)(path);
|
---|
37 | const convertedParams = (0, _params.default)(path, ignoreFunctionLength);
|
---|
38 |
|
---|
39 | if (convertedRest || convertedParams) {
|
---|
40 | path.scope.crawl();
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
45 | };
|
---|
46 | });
|
---|
47 |
|
---|
48 | exports.default = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.