-
Notifications
You must be signed in to change notification settings - Fork 195
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
Map returns an Immutable object #42
Comments
This is by design. One of the invariants of the library is that once you invoke However, since you can pass For example: _.map(Immutable([1,2,3]), function() {
return React.createElement( "div", null );
});
// no error |
I don't think this makes much sense for the map function. You are also suggesting using a non-standard map implementation for a library that has 'backwards-compatible' in the first line of its summary. |
I sympathize with the fact that this That said, I don't think it makes sense to couple this library to React, and I don't see a strong case for changing As such, I appreciate your perspective, but the current design still makes the most sense to me overall. 😃 |
Agree with @rtfeldman here. To quote the description of Array.map:
Well... now make it for Immutables:
This is in fact the only logical thing to do - you're operating on a specific type and returning a similar but different type would be... a bit wacky to say the least. |
I'd like to reopen this discussion in the light that nowadays Here's a problem I ran into yesterday when using
The reason the above fails is that Draft.js' I worked around it by running I think it makes a lot of sense to make plain-old-js-objects returned from Thoughts? |
@agurtovoy I'm having the same issue with |
I don't really understand why .map is wrapped to return an Immutable object. This seems needlessly restricting. In combination with #16, this also causes unexpected stack overflow errors.
The text was updated successfully, but these errors were encountered: