Gathering detailed insights and metrics for ukkonen
Gathering detailed insights and metrics for ukkonen
Gathering detailed insights and metrics for ukkonen
Gathering detailed insights and metrics for ukkonen
npm install ukkonen
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.4
Supply Chain
99.5
Quality
76.4
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
130 Stars
92 Commits
4 Forks
6 Watchers
5 Branches
1 Contributors
Updated on May 19, 2025
Latest Version
2.2.0
Package Id
ukkonen@2.2.0
Unpacked Size
1.77 MB
Size
1.64 MB
File Count
16
NPM Version
10.9.2
Node Version
23.11.0
Published on
Apr 29, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
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.
1npm install --save ukkonen
You can find the distance between the strings Ukkonen
and Levenshtein
the following way:
1var ukkonen = require("ukkonen"); 2 3assert.equal(ukkonen("Ukkonen", "Levenshtein"), 8);
If you want to limit the distance by a given threshold:
1var ukkonen = require("ukkonen"); 2 3assert.equal(ukkonen("Ukkonen", "Levenshtein", 6), 6); 4assert.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
# ukkonen: Edit distance one word (14 examples)
ok ~18 ms (0 s + 17993165 ns)
# leven: Edit distance one word (14 examples)
ok ~13 ms (0 s + 13155407 ns)
# ukkonen: Edit distance on sentence with small differences
ok ~1.66 ms (0 s + 1656841 ns)
# leven: Edit distance on sentence with small differences
ok ~7.23 ms (0 s + 7233814 ns)
# ukkonen: Edit distance on paragraphs with small differences
ok ~5.37 ms (0 s + 5367561 ns)
# leven: Edit distance on paragraphs with small differences
ok ~416 ms (0 s + 416468504 ns)
# ukkonen: Edit distance on longer texts with small differences
ok ~10 ms (0 s + 10305586 ns)
# leven: Edit distance on longer texts with small differences
ok ~1.7 s (1 s + 703731130 ns)
# ukkonen: Edit distance on longer texts with many differences
ok ~3.28 s (3 s + 280166305 ns)
# leven: Edit distance on longer texts with many differences
ok ~2.52 s (2 s + 519432479 ns)
# ukkonen: Edit distance on longer texts with small differences and a threshold of 20
ok ~9.69 ms (0 s + 9691021 ns)
# leven: Edit distance on longer texts with small differences and a threshold of 20
ok ~1.61 s (1 s + 610079082 ns)
# ukkonen: Edit distance on longer texts with many differences and a threshold of 40
ok ~15 ms (0 s + 15225792 ns)
# leven: Edit distance on longer texts with many differences and a threshold of 40
ok ~2.54 s (2 s + 539519721 ns)
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.
No vulnerabilities found.
Reason
12 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/2 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More