Alex Rivera | Logout

JavaScript based diff utility

Asked 2010-06-16T13:22:40.123
76

I'm looking for a diff equivalent written in JavaScript that only returns/prints relevant lines. I don't want both full text displayed next to each other with the differences highlighted, but just want the actual differences (plus some buffer lines to know where the difference is), similar to the output from the linux diff utility.

Does anybody know a javascript function that does this? All differences should be recognized (even changed whitespace). Thanks.

Edit
Report

1 Answer

32

There's also google-diff-match-patch from Google

Also available on NPM

npm install diff-match-patch
answered 2012-12-31T09:24:45.753

Your Answer