-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
executeBound on var arg constructors #2214
Comments
FWIW lodash didn't support this until 3.9.0 (last month). Not sure if that affects the priority but it's something to consider. |
Any hints to get this working jdd? |
See createCtorWrapper. Support is a side effect of patching it to work with ES6 class constructors. |
I have solutions of varying degrees:
|
I'm not a fan of hybrid (obviously I dig the JDD way :P) but it looks like the |
Switch on bind does look slightly preferable. Creating a new switch/case pyramid of doom would be distasteful, even more so if it puts an upper limit on the number of arguments. |
The issue is the fallback for old ie will be inconsistent |
The best way to handle this may be to do as jdd decided and drop explicit support for non es5 and defer this stuff to es5-shim |
I'm OK with the upper limit here as it only affects calls to bound build-ins invoked as a constructor or a bound ES6 class constructors (where supported natively). The upper limit of 7 covers the built-in constructor case and should be reasonable for others. If not it can be revisited/added-to to. The upside to this approach is consistency across environments and other methods, as I use the bound Ctor behavior for partialed and curried methods as well. |
As mentioned earlier (#2199),
exectueBound
doesn't support all ofFunction.prototype.bind
cases on constructors which take variable arguments. As the main implementation ofbind
no longer uses the native implementation, it's important we fix it.Lodash currently supports these cases.
The text was updated successfully, but these errors were encountered: