Skip to content
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

Opt-out of array merging #79

Closed
amannn opened this issue Nov 25, 2015 · 4 comments
Closed

Opt-out of array merging #79

amannn opened this issue Nov 25, 2015 · 4 comments

Comments

@amannn
Copy link

amannn commented Nov 25, 2015

Is there a way to opt-out of the array merging?

@crudh
Copy link
Collaborator

crudh commented Nov 25, 2015

What do you mean? If you merge A with B and both contain the array named C then the result will contain the array from B. Do you want the result to ignore the array from B and keep the array from A?

@amannn
Copy link
Author

amannn commented Nov 25, 2015

I'd like to do something like this:

let o = Immutable({arr: [{id: 2}]});
o = o.merge({arr: [{id: 3}]}, {mergeArray: false});
// o is {arr: [{id: 3}]}

So the array from B should override the array from A.

With the current implementation the result is {arr: [{id: 2}, {id: 3}]}

@crudh
Copy link
Collaborator

crudh commented Nov 25, 2015

This is my output when I test with 3.0.0 and 4.0.2:

var o = immutable({arr: [{id: 2}]});
o = o.merge({arr: [{id: 3}]});
// o is {arr: [{id: 3}]}

@amannn
Copy link
Author

amannn commented Nov 26, 2015

Oh, you're of course totally right! Sorry for the annoyance – I mixed this up with another library. Everything works as expected.

@amannn amannn closed this as completed Nov 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants