everyutil
Version:
A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.
13 lines (12 loc) • 475 B
TypeScript
/**
* Returns a similarity score between two strings (0..1, Levenshtein-based).
*
* Uses normalized Levenshtein distance: 1 means identical, 0 means completely different.
* Example: stringSimilarity("kitten", "sitting") → 0.714
*
* @author @dailker
* @param {string} a - First string.
* @param {string} b - Second string.
* @returns {number} Similarity score between 0 and 1.
*/
export declare function stringSimilarity(a: string, b: string): number;