-
Notifications
You must be signed in to change notification settings - Fork 184
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
collections breaks Array.from with Iterables #169
Comments
It implicitly breaks our code too (i had got 4 debug hours) :( |
Yeah, I lost the better part of a day to this too. It broke some code completely unrelated to anything near the collections stuff, and ended up being a real bitch to track down. Blindly overwriting Array.from seems like a bad idea, but to do it with a non-conformant implementation really blows my mind. |
This Array.from may have been written before the current one even existed or was final. Iterators changed in the past 5 years. So if you're happy with the rest of this library, give the author(s) some credits there. Thanks @a-x- for the PR, it's a step in the right direction to use the native implementation when available, but the shim has to be re-aligned and do what native Array.from does, contributions welcomed! |
This issue is addressed with Collections version 2. However, this is not backward-compatible with the MontageJS install base, so it is not default. |
The same for Before: [5, 12, 8, 130, 44].find((element) => {
return element > 10;
});
// returns 12 After: [5, 12, 8, 130, 44].find((element) => {
return element > 10;
});
// returns -1
// and also breaks Joi.validate() because of this It is a really dangerous game to modify built-in prototypes. |
Output:
|
In my opinion, a major version needs to be released that removes these shims. The simplest solution would be to republish version 2 as a new major that jumps ahead of the latest major versions that are designed to retain backward compatibility with MontageJS. However, I am no longer vested in this effort. The best people to make this call are @marchant and @hthetiot, who have most recently contributed substantially. @Stuk and I did have an alternative idea to publish these collections as individual packages under I’m all for enabling any volunteers to bring Collections into the modern era. I imagine this will involve deprecating |
Another victim here. v2 branch solved the issue but I really think a warning should be added to: |
Array.length gets broken for some libraries in React Native, maybe React also, like Victory Native, React native SVG, etc. I can reproduce the error if required. Need a fix or workaround for this. Please help. |
@aditya1711 have you read the conversation above? Proposed solution is to use v2 branch. Have you tried this? |
Okay, I didn't know it didn't get merged with the master. It's working now. Thanks a lot for your help and a quick reply. |
collections breaks
Array.from
with Iterables. This can be reproduced with the following code:Output:
Environment:
collections v5.0.6
node v4.4.7
Mac OS X 10.12.2
The text was updated successfully, but these errors were encountered: