Socket
Socket
Sign inDemoInstall

@types/js-levenshtein

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/js-levenshtein

TypeScript definitions for js-levenshtein


Version published
Weekly downloads
2M
increased by3.26%
Maintainers
1
Install size
2.83 kB
Created
Weekly downloads
 

Package description

What is @types/js-levenshtein?

The @types/js-levenshtein package provides TypeScript type definitions for the js-levenshtein package, which is an efficient JavaScript implementation of the Levenshtein algorithm. This algorithm calculates the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one word into another. The type definitions enable TypeScript developers to use js-levenshtein in their projects with type checking, ensuring that they pass the correct types of arguments to the functions and use the returned values as expected.

What are @types/js-levenshtein's main functionalities?

Calculating Levenshtein Distance

This feature allows you to calculate the Levenshtein distance between two strings, which is the minimum number of single-character edits required to change one string into the other. The code sample demonstrates how to import the levenshtein function and use it to calculate the distance between 'kitten' and 'sitting', which is 3.

import levenshtein from 'js-levenshtein';
const distance = levenshtein('kitten', 'sitting');
console.log(distance); // Output: 3

Other packages similar to @types/js-levenshtein

Readme

Source

Installation

npm install --save @types/js-levenshtein

Summary

This package contains type definitions for js-levenshtein (https://github.com/gustf/js-levenshtein).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-levenshtein.

index.d.ts

/**
 * Calculates Levenshtein distance between two strings
 */
declare function levenshtein(compareFrom: string, compareTo: string): number;

export = levenshtein;

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by Pyry Rouvila.

FAQs

Last updated on 07 Nov 2023

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