* Finds the common prefix between two strings
(a: string, b: string)
| 573 | * Finds the common prefix between two strings |
| 574 | */ |
| 575 | function findCommonPrefix(a: string, b: string): string { |
| 576 | const minLength = Math.min(a.length, b.length) |
| 577 | let i = 0 |
| 578 | while (i < minLength && a[i] === b[i]) { |
| 579 | i++ |
| 580 | } |
| 581 | return a.substring(0, i) |
| 582 | } |
| 583 | |
| 584 | /** |
| 585 | * Finds the longest common prefix among an array of suggestion items |
no outgoing calls
no test coverage detected