export const closest = (path: string, suggestions: string[]) => { const partialMatch = suggestions.find((suggestion) => suggestion.includes(path)); if (partialMatch) return partialMatch; const closestMatch = suggestions.reduce((prev, curr) => { return prev.length > curr.length ? prev : curr; }, ''); return closestMatch; };