Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

fastest-levenshtein

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Issues
File Explorer

Advanced tools

fastest-levenshtein

Fastest Levenshtein distance implementation in JS.

    1.0.16latest

Version published
Maintainers
1
Weekly downloads
6,451,086
decreased by-17.98%

Weekly downloads

Readme

Source

fastest-levenshtein :rocket:

Fastest JS/TS implemenation of Levenshtein distance.
Measure the difference between two strings.

Build Status Coverage Status Language grade: JavaScript npm

$ npm i fastest-levenshtein

Usage

Node

const {distance, closest} = require('fastest-levenshtein') // Print levenshtein-distance between 'fast' and 'faster' console.log(distance('fast', 'faster')) //=> 2 // Print string from array with lowest edit-distance to 'fast' console.log(closest('fast', ['slow', 'faster', 'fastest'])) //=> 'faster'

Deno

import {distance, closest} from 'https://deno.land/x/fastest_levenshtein/mod.ts' // Print levenshtein-distance between 'fast' and 'faster' console.log(distance('fast', 'faster')) //=> 2 // Print string from array with lowest edit-distance to 'fast' console.log(closest('fast', ['slow', 'faster', 'fastest'])) //=> 'faster'

Benchmark

I generated 500 pairs of strings with length N. I measured the ops/sec each library achieves to process all the given pairs. Higher is better.

Test TargetN=4N=8N=16N=32N=64N=128N=256N=512N=1024
fastest-levenshtein44423237021076445951049291.586.6422.245.473
js-levenshtein2126110030293982422357.6214.773.7170.934
leven196886884160643611730.347.6041.9290.478
fast-levenshtein185776112126534589.4122.705.6761.4280.348
levenshtein-edit-distance229687445149340910928.077.0951.7890.445

Relative Performance

This image shows the relative performance between fastest-levenshtein and js-levenshtein (the 2nd fastest). fastest-levenshtein is always a lot faster. y-axis shows "times faster".

Benchmark

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

FAQs

What is fastest-levenshtein?

Fastest Levenshtein distance implementation in JS.

Is fastest-levenshtein popular?

The npm package fastest-levenshtein receives a total of 5,412,744 weekly downloads. As such, fastest-levenshtein popularity was classified as popular.

Is fastest-levenshtein well maintained?

We found that fastest-levenshtein demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 02 Aug 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc