Fuzzy Match Utility Documentation

Table of Contents
Examples
Basic Usage
JavaScript Reference
fuzzyMatch
fuzzyMatchArray

Description

This module provides functions for performing fuzzy matching on strings.

Basic Usage

JavaScript Reference

fuzzyMatch(str1, str2)

Performs a fuzzy match between two strings and returns a score between 0 and 10.

import { fuzzyMatch } from './src/utils/fuzzyMatch.js';

const score = fuzzyMatch('example', 'exampel');
console.log(score); // Outputs a score between 0 and 10

Parameters:

Returns: (number): A score between 0 and 10 indicating the strength of the match.

fuzzyMatchArray(array, targetString)

Calculates the average non-zero fuzzy match score of a target string against an array of strings.

import { fuzzyMatchArray } from './src/utils/fuzzyMatch.js';

const averageScore = fuzzyMatchArray(['example', 'sample', 'exampel'], 'exampel');
console.log(averageScore); // Outputs the average non-zero score

Parameters:

Returns: (number): The average non-zero match score.