MCPcopy Create free account
hub / github.com/codeaashu/claude-code / findCommonPrefix

Function findCommonPrefix

src/hooks/fileSuggestions.ts:575–582  ·  view source on GitHub ↗

* Finds the common prefix between two strings

(a: string, b: string)

Source from the content-addressed store, hash-verified

573 * Finds the common prefix between two strings
574 */
575function 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

Callers 1

findLongestCommonPrefixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected