Skip to main content
Latest
function compareSimilarity
import { compareSimilarity } from "https://deno.land/std@0.224.0/text/compare_similarity.ts";

Sort based on word similarity

Examples

Example 1

import { compareSimilarity } from "https://deno.land/std@0.224.0/text/compare_similarity.ts";
const words = ["hi", "hello", "help"];

// words most-similar to "hep" will be at the front
words.sort(compareSimilarity("hep"));

Parameters

givenWord: string
optional
options: { caseSensitive?: boolean; }

Returns

(a: string, b: string) => number