rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 195 forks source link

Suggestion: merge method for array implementation #106

Closed OEvgeny closed 8 years ago

OEvgeny commented 8 years ago

I'm looking for a good way to merge immutable array with a new one I think it will be really cool to do things like so:

/*
storeUsers = [{id:0, name: 'James'}, undefined, {id:2, name:'Jane'}]
*/
let users = Immutable(storeUsers);
let newUsers = [null, {id:1, name: 'Jack'}];
users = users.merge(newUsers);

I think it will be easy to implement, and I can try with pull-request. What are you thought on this?

rtfeldman commented 8 years ago

Thanks for taking the time to write this up, but I prefer to keep the API small and compact, so I'd rather not add this. :smiley:

OEvgeny commented 8 years ago

@rtfeldman good point :smile: