Socket
Socket
Sign inDemoInstall

levenshtein-edit-distance

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

levenshtein-edit-distance

Levenshtein edit distance. No cruft. Real fast.


Version published
Weekly downloads
212K
decreased by-6.56%
Maintainers
1
Weekly downloads
 
Created
Source

levenshtein-edit-distance Build Status Coverage Status

Levenshtein edit distance (by Vladimir Levenshtein). No cruft. Real fast.

Installation

npm:

$ npm install levenshtein-edit-distance

Component:

$ component install wooorm/levenshtein-edit-distance

Bower:

$ bower install levenshtein-edit-distance

Usage

var levenshteinDistance = require('levenshtein-edit-distance');

levenshteinDistance('levenshtein', 'levenshtein'); // 0
levenshteinDistance('sitting', 'kitten'); // 3
levenshteinDistance('gumbo', 'gambol'); // 2
levenshteinDistance('saturday', 'sunday'); // 3

/* Case sensitive! */
levenshteinDistance('DwAyNE', 'DUANE') !== levenshteinDistance('dwayne', 'DuAnE'); // true

/* Order insensitive */
levenshteinDistance('aarrgh', 'aargh') === levenshteinDistance('aargh', 'aarrgh'); // true

Other Levenshtein libraries

Benchmark

On a MacBook Air, it runs about 1,915,000 op/s.

Run the benchmark yourself:

$ npm run benchmark
             Levenshtein — to be fair, it lets you inspect a matrix
    129 op/s » op/s * 1,000

             natural — to be fair, it offers more options
    212 op/s » op/s * 1,000

             levenshtein-deltas
    252 op/s » op/s * 1,000

             levenshtein-component
    335 op/s » op/s * 1,000

             fast-levenshtein
  1,251 op/s » op/s * 1,000

             Leven — fast.
  1,541 op/s » op/s * 1,000

             levenshtein-edit-distance — this module
  1,915 op/s » op/s * 1,000

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 30 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc