I'm looking for a javascript diff algorithm implementation or library, which has been tested on and works with arbitrary utf8 text files.
All of the ones I found so far (say for example, http://ejohn.org/projects/javascript-diff-algorithm/) fail on corner cases
(Try using a file which contains the string '__proto__'
in my example library.)
Maybe this will help you — jsdiff
I'm a fan of google diff match patch. You can try out an example here.
There are different cleanup option to tweak the level of commonality between the diffs. I don't like the semantic cleanup option as I find it's too aggressive, but the efficiency cleanup with a value of 10 works well for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With