Hacker News new | ask | show | jobs
by zzzaim 4143 days ago
Alas, I've been working on something like this for the last few weeks on and off, especially the "patching" of immutable data, my solution was to use jiff[1], which generates JSON Patch operations[2], which is then applied to the Immutable object using immpatch[3] (a lib I wrote).

A cursory look at Remutable seems it to be the better and faster option :)

[1] https://github.com/cujojs/jiff

[2] https://tools.ietf.org/html/rfc6902

[3] https://github.com/zaim/immpatch

(edited formatting)

1 comments

That was nearly exactly my initial approach! :)

However I realized actual diffing was really slow, especially for large collections, as it involves scanning the entire structure for changes, when in fact all changes could simply be flagged upon mutation. Conceptually, it performs diffing (ie. it gives you a diff object), its just much, much faster!