Ukkonens approximate string matching algorithm for finding edit distance similar to Levenshtein
npm install ukkonen

This project implements the Approximate String Matching algorithm by Esko Ukkonen extended with ideas from An Extension of Ukkonen's Enhanced Dynamic Programming ASM Algorith by Hal Berghel and David Roach.
Ukkonen's algorithm is very competitive with the Levenshtein distance and for longer strings it is much more performant than Levenshtein distance.
In addition to being a competitive alternative to Levenshtein distance, Ukkonen's algorithm also allows you to provide a threshold for the distance which increases the performance even more for texts that are longer than the threshold.

Above you can see the different of using Levenshtein distance and Ukkonen's algorithm for matching sub-trees when diffing HTML.
``sh`
npm install --save ukkonen
You can find the distance between the strings Ukkonen and Levenshtein the following way:
`js
var ukkonen = require("ukkonen");
assert.equal(ukkonen("Ukkonen", "Levenshtein"), 8);
`
If you want to limit the distance by a given threshold:
`js
var ukkonen = require("ukkonen");
assert.equal(ukkonen("Ukkonen", "Levenshtein", 6), 6);
assert.equal(ukkonen("Ukkonen", "Levenshtein", 10), 8);
`
The library is ES6 and will work with any JavaScript bundler in the browser as well as Node versions with ES6 support.
I have benchmarked the library against the fastest Levenshtein distance implementation on NPM.
`
Running benchmarks with 1000 iterations
Obviously the authors of the papers describing the algorithm Esko Ukkonen, Hal Berghel and David Roach.
I stole a lot of ideas from Sindre Sorhus's leven library and I also used it to test my implementation against.