I have absolutely written a diffing algorithm like this faster much than it would take to find an appropriate version on npm.
Every so often I try to reach for an npm library, only to find out that it's suboptimal, doesn't handle my edge cases, or just plain worse than the code I would have written.
The last time I tried to do this, I wanted a hash map with custom equality functions on the keys, since JS doesn't have one built-in by default. I searched for about 2 hours and didn't find a single one that actually worked (several claimed to be, but actually didn't work...)
So I wrote my own in about 100 lines. [0]
Data structures and algorithms tend to be really awful on npm.
Every so often I try to reach for an npm library, only to find out that it's suboptimal, doesn't handle my edge cases, or just plain worse than the code I would have written.
The last time I tried to do this, I wanted a hash map with custom equality functions on the keys, since JS doesn't have one built-in by default. I searched for about 2 hours and didn't find a single one that actually worked (several claimed to be, but actually didn't work...)
So I wrote my own in about 100 lines. [0]
Data structures and algorithms tend to be really awful on npm.
[0] https://github.com/magcius/noclip.website/blob/master/src/Ha...