Skip to content

@technobuddha > library > String > Fuzzy Match

Function: levenshteinDistance() ​

ts
function levenshteinDistance(
   input: string, 
   comparedTo: string, 
   options: LevenshteinDistanceOptions): number;

Defined in: levenshtein-distance.ts:23

Compute the levenshtein distance between two strings (similarity)

Parameters ​

ParameterTypeDescription
inputstringThe string
comparedTostringThe string to compare to
optionsLevenshteinDistanceOptionssee LevenshteinDistanceOptions

Returns ​

number

the levenshteinDistance between the two strings (0 for no similarity through 1 for equal)

Default Value ​

ts
caseInsensitive true