get-parameter-names icon indicating copy to clipboard operation
get-parameter-names copied to clipboard

Support for arguments destructuring

Open Vincz opened this issue 7 years ago • 2 comments

Could be cool to be able to handle functions with arguments destructuring like that :

function({ prop1, "my-prop2": prop2 = 'default', p3 : { sp1 }, ...rest }, arg2) => {
};

That would produce an array like this for example:

[["prop1", "my-prop2", ["p3", ["sp1"]]], "arg2"]

Or event better with more info:

[{
    type: object, 
    properties: [
        {name: prop1}, 
        {name: "my-prop2", as:  "prop2", default: "default"},
        {name: p3, type: object, properties: ["sp1"]}
    ]
}]

And why not array destructuring support too ?

Vincz avatar Oct 31 '17 02:10 Vincz

I've tried to find a lib that handle functions with params destructuring, and nothing until now...

+1 for this issue. I guess it really would be useful once destructuring is getting more popular.

ViniciusTavares avatar Aug 08 '18 22:08 ViniciusTavares

Try using tinspector its supported parameter destructuring, rest parameters and complex default value.

https://github.com/plumier/tinspector

ktutnik avatar Feb 29 '20 05:02 ktutnik