Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

levenary

tanhauhau2.4mMIT1.1.1TypeScript support: included

npm-version github-actions

leven, levenshtein, distance, array, string, algorithm, algo, string, difference, diff, fast, fuzzy, similar, similarity, compare, comparison, edit, text, match, matching

readme

levenary

npm-version github-actions

Given a string, A and an array of strings XS, return the string X from XS whose Levenshtein distance from A is minimal.

Install

$ npm install levenary

Usage

import levenary from 'levenary';

levenary('cat', ['cow', 'dog', 'pig']);
//=> 'cow'

Why levenary?

  1. Based on leven, the fastest JS implementation of the Levenshtein distance algorithm
  2. Only 1 API. Simple and clean. If you want more, please use didyoumean2.
  3. Flow and TypeScript support.

Benchmark

$ npm run bench
  311,915 op/s » levenary
   74,030 op/s » didyoumean
  141,423 op/s » didyoumean2