@putout/plugin-variables 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,12 +23,12 @@ const {
|
|
|
23
23
|
isFunctionDeclaration,
|
|
24
24
|
isArrayExpression,
|
|
25
25
|
isRestElement,
|
|
26
|
+
isArrayPattern,
|
|
26
27
|
} = types;
|
|
27
28
|
|
|
28
29
|
export default ({use, declare, addParams}) => {
|
|
29
30
|
const traverseObj = traverseObjectExpression(use);
|
|
30
|
-
|
|
31
|
-
const processObj = processObjectPattern({
|
|
31
|
+
const declareObject = processObjectPattern({
|
|
32
32
|
use,
|
|
33
33
|
declare,
|
|
34
34
|
});
|
|
@@ -64,7 +64,7 @@ export default ({use, declare, addParams}) => {
|
|
|
64
64
|
const param = path.get('param');
|
|
65
65
|
|
|
66
66
|
if (param.isObjectPattern())
|
|
67
|
-
return
|
|
67
|
+
return declareObject(param.get('properties'));
|
|
68
68
|
|
|
69
69
|
if (!param.isIdentifier())
|
|
70
70
|
return;
|
|
@@ -141,7 +141,7 @@ export default ({use, declare, addParams}) => {
|
|
|
141
141
|
|
|
142
142
|
for (const elPath of elements) {
|
|
143
143
|
if (elPath.isObjectPattern()) {
|
|
144
|
-
|
|
144
|
+
declareObject(elPath.get('properties'));
|
|
145
145
|
continue;
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -213,7 +213,7 @@ export default ({use, declare, addParams}) => {
|
|
|
213
213
|
use(rightPath, rightPath.node.name);
|
|
214
214
|
},
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
ArrayExpression(path) {
|
|
217
217
|
const {elements} = path.node;
|
|
218
218
|
|
|
219
219
|
for (const el of elements) {
|
|
@@ -557,7 +557,12 @@ export default ({use, declare, addParams}) => {
|
|
|
557
557
|
|
|
558
558
|
/* istanbul ignore else */
|
|
559
559
|
if (isObjectPattern(node)) {
|
|
560
|
-
|
|
560
|
+
declareObject(paramPath.get('properties'));
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (isArrayPattern(node)) {
|
|
565
|
+
declareArray(paramPath.get('elements'));
|
|
561
566
|
continue;
|
|
562
567
|
}
|
|
563
568
|
}
|
|
@@ -125,6 +125,9 @@ export const traverseArrayExpression = (use) => {
|
|
|
125
125
|
for (const elementPath of elementsPaths) {
|
|
126
126
|
const {node} = elementPath;
|
|
127
127
|
|
|
128
|
+
if (isIdentifier(node))
|
|
129
|
+
use(elementPath, node.name);
|
|
130
|
+
|
|
128
131
|
if (node.properties)
|
|
129
132
|
traverseObjExpression(elementPath.get('properties'));
|
|
130
133
|
}
|
package/package.json
CHANGED