I wrote this algorithm as an experiment. I suggest that you read the blog post I wrote about it to understand for what this might be good for, and see how this algorithm compares to others.
You are welcome to use this algorithm, but I strongly recommend checking out jsdiff first.