goatslacker / get-parameter-names

Retrieves the argument names of a function
46 stars 13 forks source link

Fix for multi-line fat arrow methods with multiple no parens fat arrow functions #7

Closed CaptEmulation closed 7 years ago

CaptEmulation commented 8 years ago

Found a function the get-parameter-names parses wrong:

const fn = items => items.map(
  i => t.foo);

was

getParameterNames(fn); // => [ 'items', 'i' ]

is now

getParameterNames(fn); // => [ 'items' ]
CaptEmulation commented 8 years ago

@benbotto fix is better as my fix only resolves 1 out of 3 of his test cases. Have merged #8 and fixed unit tests.

benbotto commented 8 years ago

@CaptEmulation have you published your fork somewhere? If not, I'm going to publish a scoped package with this PR in place. This bug is causing an issue in my software, and @goatslacker may be MIA (11 days since you made this PR).

CaptEmulation commented 8 years ago

I have not. Please feel free

CaptEmulation commented 8 years ago

looks like travis is still complaining. Will look into it

CaptEmulation commented 8 years ago

@benbotto @goatslacker Updated and travis-ci is now happy

CaptEmulation commented 8 years ago

@goatslacker: pretty please can we merge this and bump npm giphy 7

benbotto commented 8 years ago

I published a scoped version, here: https://www.npmjs.com/package/@avejidah/get-parameter-names The fork is on github (https://github.com/benbotto/get-parameter-names). There is an issue in this PR (PR7) that I have addressed in commit 1a8a684b1e56895da4138f3c5480705dc4c85f69: specifically, no-argument arrow functions are failing.

CaptEmulation commented 8 years ago

Thanks @benbotto 👍 Updated this PR with that commit

eddyystop commented 7 years ago

https://github.com/benbotto/get-parameter-names 0.3.2 still has the following problem: ( a = 1 , b=2, c = (err, data)=>{}) => {} returns ['a', 'b', 'c', 'data']

CaptEmulation commented 7 years ago

@eddyystop @benbotto Completely rewritten at CaptEmulation/get-parameter-names. Released as @captemulation/get-parameter-names@1.0.0. Now handles ( a = 1 , b=2, c = (err, data)=>{}) => {}

CaptEmulation commented 7 years ago

I hope you're OK @goatslacker