Closed princjef closed 7 years ago
Thanks for the PR!
I'm still unsure about the switch back from ...args
to arguments
. IIRC, arguments
is deprecated in favor of ...args
. Maybe we need to investigate and fix the Babel build instead.
afaik the rest operator and arguments
have separate meanings and per MDN, arguments
hasn't been deprecated.
As I was debugging the test issue, I looked through the generated output of both the published code (2.3.2) and the output when compiling against latest in master with a fresh npm install
. I snagged screenshots so you can see the behavior of both:
Published (2.3.2)
Master
The callback
line is the only one that changed in a substantive way. From what I can tell, the version that's published had a transpiler bug, since the two 3
s in the arguments computation cancel out. With that behavior, even if you only provide one argument to the function, it will be assigned to the callback
variable. I'm not sure how optional/default params and rest params combine, but ...args
definitely shouldn't be overlapping with script
.
I looked around a bit in the babel issues and found this. I'm not sure if it stems from the same bug, but it's a similar problem (treating a trailing rest param as if it represents the entire argument list).
@jbmusso this looks like a good PR to me.
Accessing the callback at the end of the arguments using the ES5 pattern instead of the ES6 pattern like @princjef has done is safer as it's not relying on the compilation and nuances of Babel.
In order for me to move ahead with this PR in my work I've created a master-alt
branch in my fork and I've published it on npmjs as gremlin-alt
. Version 1.0.1 of my publish has the changes from this PR.
My production app that uses this module has a number of integration tests that all pass with this alternate publish.
This gremlin-alt
module is just a temporary solution and I plan to continue to use this module once you've had the chance to publish this PR and some others.
Thanks, I'll review it this weekend and most likely merge/publish :). Unfortunately I lack free time at the moment.
That didn't take that long actually. Publishing new release on npm in a few minutes.
thanks @jbmusso and @guyellis!
Bumps the
ws
dependency up to 1.x, resolving issues like those seen in #60.Also fixes the
execute()
method to work with the updated version of babel, which doesn't generate the same code for methods that combine optional and rest parameters as previous versions (a.k.a. what built version 2.3.2 of this library)