editDistance() — react Function Reference
Architecture documentation for the editDistance() function in runner-watch.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD dc35076c_2633_33ab_2f2d_a01d993013d0["editDistance()"] 3c2dde8c_5e90_a277_13bd_39083b18cadb["runner-watch.ts"] dc35076c_2633_33ab_2f2d_a01d993013d0 -->|defined in| 3c2dde8c_5e90_a277_13bd_39083b18cadb 4bde4ec0_48d3_f978_b35d_bcdb20497109["filterFixtures()"] 4bde4ec0_48d3_f978_b35d_bcdb20497109 -->|calls| dc35076c_2633_33ab_2f2d_a01d993013d0 style dc35076c_2633_33ab_2f2d_a01d993013d0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/snap/src/runner-watch.ts lines 191–216
function editDistance(a: string, b: string): number {
const m = a.length;
const n = b.length;
// Create a 2D array for memoization
const dp: number[][] = Array.from({length: m + 1}, () =>
Array(n + 1).fill(0),
);
// Base cases
for (let i = 0; i <= m; i++) dp[i][0] = i;
for (let j = 0; j <= n; j++) dp[0][j] = j;
// Fill in the rest
for (let i = 1; i <= m; i++) {
for (let j = 1; j <= n; j++) {
if (a[i - 1] === b[j - 1]) {
dp[i][j] = dp[i - 1][j - 1];
} else {
dp[i][j] = 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]);
}
}
}
return dp[m][n];
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does editDistance() do?
editDistance() is a function in the react codebase, defined in compiler/packages/snap/src/runner-watch.ts.
Where is editDistance() defined?
editDistance() is defined in compiler/packages/snap/src/runner-watch.ts at line 191.
What calls editDistance()?
editDistance() is called by 1 function(s): filterFixtures.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free