Skip to main content
Module

std/text/mod.ts>compareSimilarity

The Deno Standard Library
Latest
function compareSimilarity
Re-export
import { compareSimilarity } from "https://deno.land/std@0.224.0/text/mod.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