(first: string, second: string)
| 428 | // suggestions. Exported only so it can be unit-tested directly; the CLI uses it |
| 429 | // through the private `WebpackCLI.#distance`. |
| 430 | export function distance(first: string, second: string): number { |
| 431 | let a = first; |
| 432 | let b = second; |
| 433 | |
| 434 | if (a.length < b.length) { |
| 435 | const tmp = b; |
| 436 | |
| 437 | b = a; |
| 438 | a = tmp; |
| 439 | } |
| 440 | |
| 441 | if (b.length === 0) { |
| 442 | return a.length; |
| 443 | } |
| 444 | |
| 445 | levenshteinPeq ??= new Uint32Array(0x10000); |
| 446 | |
| 447 | return a.length <= 32 ? myers32(a, b, levenshteinPeq) : myersX(a, b, levenshteinPeq); |
| 448 | } |
| 449 | |
| 450 | class ConfigurationLoadingError extends Error { |
| 451 | name = "ConfigurationLoadingError"; |
no test coverage detected