Conversation
|
Hi and very thanks! And yet, I'm not sure if this case really is "args". I always wonder what to do in such complex cases. That's probably the beauty of the plugins structure. I really want to first publish the #72 / #67 (v6 release) and then consider what to do with these cases. For now you can literally make another plugin like the following export default () => (node, result) => {
result.destructuredArgs = result.destructuredArgs || [];
node.params.forEach((param) => {
if (
param.type === 'ObjectPattern' &&
param.properties &&
param.properties.length > 0
) {
param.properties.forEach((prop) => {
const { name } = prop.value;
result.destructuredArgs.push(name);
});
}
})
return result
}and if you want them all to be in |
|
I update the tests, you just need to update the snapshots with Jest's |
|
Actually, why not create a new file in import body from './body';
import props from './props';
import params from './params';
+ import destructured from './destructured-args';and later result = props(app)(node, result);
result = params(app)(node, result);
result = body(app)(node, result);
+ result = destructured(app)(node, result);But in anyway, a new published version probably won't be that soon that you may need it, so just use the above snippet. |
|
Thank you!! |
|
@tunnckoCore HI! |
|
oh) I found the bug on my code ) I will fix this asap) |
I found the decide) |
Just get your code from here and pass it to https://github.com/tunnckoCore/opensource/tree/master/@packages/parse-function#use
|
Added parse arguments of function like:
Which return result.args =
['x', 'y']@tunnckoCore Can you help me with tests?