Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function findBestMatch(find: string, elements: T[], options: FindBestMatchOptions): T | undefined {
options.caseSensitive = "caseSensitive" in options ? options.caseSensitive : false;
options.threshold = "threshold" in options ? options.threshold : 0.5;
return (didYouMean(find, elements, {
caseSensitive: options.caseSensitive,
threshold: options.threshold,
matchPath: [options.matchKey] as [string],
returnType: dym.ReturnTypeEnums.FIRST_CLOSEST_MATCH,
trimSpaces: false
}) as unknown) as T | undefined;
}