strings - xml diff javascript




Does nodejs have a working diff library or algorithm? (4)

Have a look at the JavaScript library wikEd diff. It has Unicode and multilingual support. It also detects and highlights block moves and is word/character based. You can also use the online too/demo for testing different settings and to look at the internal data structures. The library's code is fully commented.

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.)


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.









diff