Gathering detailed insights and metrics for @edit-distance/myers-1986
Gathering detailed insights and metrics for @edit-distance/myers-1986
Gathering detailed insights and metrics for @edit-distance/myers-1986
Gathering detailed insights and metrics for @edit-distance/myers-1986
🧮 Reasonably efficient implementation of Eugene W. Myers's exact longest common subsequence and minimum edit-distance algorithm for JavaScript
npm install @edit-distance/myers-1986
Typescript
Module System
67.3
Supply Chain
95.1
Quality
77.9
Maintenance
100
Vulnerability
80.6
License
JavaScript (96.72%)
Shell (3.28%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
AGPL-3.0 License
2 Stars
425 Commits
1 Forks
1 Watchers
17 Branches
3 Contributors
Updated on Jun 14, 2025
Latest Version
1.1.0
Package Id
@edit-distance/myers-1986@1.1.0
Unpacked Size
766.11 kB
Size
258.87 kB
File Count
18
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
1
32
Reasonably efficient implementation of Eugene W. Myers's exact longest common subsequence and minimum edit-distance algorithm for JavaScript. See docs.
:building_construction: Caveat emptor! This is work in progress. Code may be working. Documentation may be present. Coherence may be. Maybe.
:warning: Only signed 32-bit integers are supported for
MAX
,xi
,xj
,yi
,yj
. This is also true for the valuesxj - xi
andyj - yi
but is not enforced. You should be fine if the elements of each pair have the same sign. This means you cannot diff things with more than2,147,483,647
parts (array elements, string characters, text words or lines).
1// Example 1: compute Edit Distance. 2 3import {makeScan, twoWay} from '@edit-distance/myers-1986'; 4 5const scan = makeScan(twoWay); 6 7const ed = (x, y) => { 8 const eq = (xi, yi) => x[xi] === y[yi]; 9 const xi = 0; 10 const xj = x.length; 11 const yi = 0; 12 const yj = y.length; 13 const MAX = xj - xi + (yj - yi); 14 return scan(MAX, eq, xi, xj, yi, yj); 15}; 16 17ed('BANANA', 'ATANA'); // 3 18 19// Example 2: compute LCS. 20 21import {diff} from '@edit-distance/myers-1986'; 22 23const rectangles = (x, y) => { 24 const eq = (xi, yi) => x[xi] === y[yi]; 25 const xi = 0; 26 const xj = x.length; 27 const yi = 0; 28 const yj = y.length; 29 const MAX = xj - xi + (yj - yi); 30 return diff(MAX, eq, xi, xj, yi, yj); 31}; 32 33const lcs = (x, y) => { 34 let result = x.slice(0, 0); 35 let xp = 0; 36 for (const [x0, x1] of rectangles(x, y)) { 37 result = result.concat(x.slice(xp, x0)); 38 xp = x1; 39 } 40 41 return result.concat(x.slice(xp, x.length)); 42}; 43 44lcs('BANANA', 'ATANA'); // AANA
input | fast-myers-diff v3.0.1 | modern.js v0.0.1 | module.js v0.0.1 | cjs v0.0.1 |
---|---|---|---|---|
N+M=220 N=100 M=120 LCS=100 DEL=0 INS=20 | 77,170 ops/sec | 99,952 ops/sec | 97,806 ops/sec | 100,333 ops/sec |
N+M=220 N=120 M=100 LCS=100 DEL=20 INS=0 | 68,575 ops/sec | 90,582 ops/sec | 89,178 ops/sec | 90,030 ops/sec |
N+M=220 N=110 M=110 LCS=100 DEL=10 INS=10 | 63,494 ops/sec | 83,439 ops/sec | 81,201 ops/sec | 82,661 ops/sec |
N+M=224 N=14 M=210 LCS=10 DEL=4 INS=200 | 7,112 ops/sec | 10,346 ops/sec | 10,406 ops/sec | 10,898 ops/sec |
N+M=20020 N=10000 M=10020 LCS=10000 DEL=0 INS=20 | 3,282 ops/sec | 4,313 ops/sec | 4,174 ops/sec | 4,415 ops/sec |
N+M=20020 N=10020 M=10000 LCS=10000 DEL=20 INS=0 | 3,317 ops/sec | 4,040 ops/sec | 4,035 ops/sec | 4,947 ops/sec |
N+M=20020 N=10010 M=10010 LCS=10000 DEL=10 INS=10 | 2,414 ops/sec | 2,939 ops/sec | 2,843 ops/sec | 3,009 ops/sec |
N+M=220 N=110 M=110 LCS=10 DEL=100 INS=100 | 1,607 ops/sec | 2,737 ops/sec | 2,720 ops/sec | 2,887 ops/sec |
N+M=20200 N=10000 M=10200 LCS=10000 DEL=0 INS=200 | 871 ops/sec | 1,258 ops/sec | 1,254 ops/sec | 1,293 ops/sec |
N+M=20200 N=10200 M=10000 LCS=10000 DEL=200 INS=0 | 844 ops/sec | 1,240 ops/sec | 1,258 ops/sec | 1,309 ops/sec |
N+M=20200 N=10100 M=10100 LCS=10000 DEL=100 INS=100 | 703 ops/sec | 978 ops/sec | 976 ops/sec | 978 ops/sec |
N+M=2020 N=1010 M=1010 LCS=10 DEL=1000 INS=1000 | 19.10 ops/sec | 36.35 ops/sec | 36.45 ops/sec | 38.16 ops/sec |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
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
Reason
22 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
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