Open maxgherman opened 8 years ago
I think the problem is when you use a fat-arrow function with 1 argument and the argument is not defined with parenthesis.
Use my scoped package: https://www.npmjs.com/package/@avejidah/get-parameter-names There are other issues that are fixed there as well.
With function definition:
function test(arg1=3, /*arg2,*/ arg3='duh') { console.log(arguments); }
getParameterNames(test)
returns ["arg1", "arg"]
.
Here is another test:
function test(arg1=3, /*arg2,*/ arg345='duh') { console.log(arguments); }
getParameterNames(test)
returns ["arg1", "arg34"]
.
It seems that it works really well EXCEPT for the very last argument, on which it strips the last character for some reason. Hope this helps. Oh, and the tests were run in the chrome browser console window.
@troywweber7 These tests pass correctly in my fork, and my fork has a number of other issues corrected. Use my scoped module, as described in my comment above (npm install @avejidah/get-parameter-names).
Input:
c => { let test2 = c.resolve(); return new Test3(test2); } Expected output:
['c']
Output:
[ 'c', 'let', 'test2' ]
Input:
c => { var test2 = c.resolve(); return new Test3(test2); } Expected output:
['c']
Output:
[ 'c', 'var', 'test2' ]
$ node -v v4.2.1