How to use the didyoumean2.ReturnTypeEnums function in didyoumean2

To help you get started, we’ve selected a few didyoumean2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github runem / lit-analyzer / packages / lit-analyzer / src / analyze / util / find-best-match.ts View on Github external
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;
}

didyoumean2

a library for matching human-quality input to a list of potential matches using the Levenshtein distance algorithm

MIT
Latest version published 9 months ago

Package Health Score

71 / 100
Full package analysis