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

set function similar to immutablejs of fb #111

Closed Poordeveloper closed 8 years ago

Poordeveloper commented 8 years ago

I am trying to replace fb's immutablejs with seamless-immutable, because it is more lightweight. But I found they have different behavior of the set function. In immutablejs, immutable.set('a', obj) will keep obj as mutable, but in seamless-immutable change obj to immutable. Can we provide a function to similar fb. I tried to modify objectSet function, it works, but arraySet does not work after my simple change "mutable[idx] = value;".

rtfeldman commented 8 years ago

I see your point, but I honestly don't think this is worth a breaking change to the existing set behavior. I also don't think it's worth adding an additional function, as I prefer to keep the API small, so I think there's just going to be some learning curve if you're coming from Immutable.js :smile: