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

Ability to set multiple values at once #13

Open
RReverser opened this issue May 6, 2015 · 4 comments
Open

Ability to set multiple values at once #13

RReverser opened this issue May 6, 2015 · 4 comments

Comments

@RReverser
Copy link

When you need to add multiple values, there is little sense in doing separate operations (and also creating intermediate objects) like:

const a = ImmutableMap([['x', 1], ['y', 2]]);
const b = a.set('z', 3).set('t', 4);

It would be nice to have .extend method that would allow to do things like:

const a = ImmutableMap([['x', 1], ['y', 2]]);
const b = a.extend({z: 3, t: 4}); // or a.extend(#{z: 3, t: 4});
@skrat
Copy link

skrat commented Oct 5, 2015

I believe this is something that can be handled by a merge operation. extend is surely confusing and hugely overloaded term.

@RReverser
Copy link
Author

@skrat merge also doesn't exist at the moment. I don't care whether it will be called merge, extend or assign, the functionality is what's interesting.

@Gozala
Copy link

Gozala commented Oct 5, 2015

I believe ideas is that spread operator will handle that:

const b = #{ ...a, z: 3, t: 4};

@ckknight
Copy link
Contributor

@Gozala: That applies to Record, not ImmutableMap.

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

4 participants