Socket
Socket
Sign inDemoInstall

leven

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    leven

Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm


Version published
Maintainers
1
Install size
6.21 kB
Created

Package description

What is leven?

The leven npm package is a JavaScript library for measuring the difference between two strings. It uses the Levenshtein distance algorithm to calculate the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one word into the other. This can be particularly useful in applications that need to perform fuzzy matching, spell checking, or any scenario where determining how similar two strings are is necessary.

What are leven's main functionalities?

Calculate Levenshtein distance

This feature allows you to calculate the Levenshtein distance between two strings, which is the number of edits needed to transform one string into the other. The code sample demonstrates how to use the leven package to find the distance between 'kitten' and 'sitting', which is 3.

"const leven = require('leven');\nconsole.log(leven('kitten', 'sitting')); // 3"

Other packages similar to leven

Readme

Source

leven Build Status

Measure the difference between two strings
One of the fastest JS implementations of the Levenshtein distance algorithm

Install

$ npm install leven

Usage

const leven = require('leven');

leven('cat', 'cow');
//=> 2

Benchmark

$ npm run bench
         165,926 op/s » leven
         164,398 op/s » talisman
           1,044 op/s » levenshtein-edit-distance
             628 op/s » fast-levenshtein
             497 op/s » levenshtein-component
             195 op/s » ld
             190 op/s » levenshtein
             168 op/s » levdist
              10 op/s » natural
  • leven-cli - CLI for this module

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 04 Apr 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc