Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/string-similarity

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/string-similarity

TypeScript definitions for string-similarity

  • 4.0.2
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
55K
decreased by-55.1%
Maintainers
1
Weekly downloads
 
Created

What is @types/string-similarity?

@types/string-similarity is a TypeScript type definition package for the string-similarity library. This library is used to find the degree of similarity between two strings, find the best match for a string from a list of strings, and more.

What are @types/string-similarity's main functionalities?

Compare Two Strings

This feature allows you to compare two strings and get a similarity score between 0 and 1, where 1 means the strings are identical.

const stringSimilarity = require('string-similarity');
const similarity = stringSimilarity.compareTwoStrings('hello', 'hallo');
console.log(similarity); // Output: 0.8

Find Best Match

This feature allows you to find the best match for a given string from a list of strings. It returns an object containing the best match and its similarity rating.

const stringSimilarity = require('string-similarity');
const matches = stringSimilarity.findBestMatch('hello', ['hi', 'hallo', 'hey']);
console.log(matches.bestMatch); // Output: { target: 'hallo', rating: 0.8 }

Find Ratings for All Matches

This feature allows you to get similarity ratings for all matches in a list of strings. It returns an array of objects, each containing a target string and its similarity rating.

const stringSimilarity = require('string-similarity');
const matches = stringSimilarity.findBestMatch('hello', ['hi', 'hallo', 'hey']);
console.log(matches.ratings); // Output: [{ target: 'hi', rating: 0.2 }, { target: 'hallo', rating: 0.8 }, { target: 'hey', rating: 0.4 }]

Other packages similar to @types/string-similarity

FAQs

Package last updated on 07 Nov 2023

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