# @types/string-similarity

> TypeScript definitions for string-similarity

Latest version **4.0.2** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/string-similarity
pnpm add @types/string-similarity
yarn add @types/string-similarity
bun add @types/string-similarity
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2023-11-07 |
| First published | 2017-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51439 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/string-similarity
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/string-similarity
- npm.io page: https://npm.io/package/@types/string-similarity

## Recent versions

- 4.0.2 (latest) — 2023-11-07
- 4.0.0 (ts3.2) — 2020-11-05
- 3.0.0 (ts2.0) — 2019-01-17
- 1.2.3 — 2023-11-07
- 1.2.2 — 2023-10-18
- 4.0.1 — 2023-10-18
- 1.2.1 — 2019-01-17
- 1.2.0 — 2017-07-17

## README

# Installation
> `npm install --save @types/string-similarity`

# Summary
This package contains type definitions for string-similarity (https://github.com/aceakash/string-similarity#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/string-similarity.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/string-similarity/index.d.ts)
````ts
export as namespace stringSimilarity;

/**
 * Returns a fraction between 0 and 1, which indicates the degree of similarity between the two strings.
 * `0` indicates completely different strings, `1` indicates identical strings. The comparison is case-insensitive.
 *
 * @param string1 The first string
 * @param string2 The second string
 * @returns A fraction from 0 to 1, both inclusive. Higher number indicates more similarity.
 */
export function compareTwoStrings(string1: string, string2: string): number;

/**
 * Compares `mainString` against each string in `targetStrings`.
 *
 * @argument mainString: The string to match each target string against.
 * @argument targetStrings: Each string in this array will be matched against the main string.
 * @returns An object with a `ratings` property, which gives a similarity rating for each target string,
 *          a `bestMatch` property, which specifies which target string was most similar to the main string,
 *          and a `bestMatchIndex` property, which specifies the index of the `bestMatch` in the `targetStrings` array.
 */
export function findBestMatch(mainString: string, targetStrings: string[]): BestMatch;

export interface Rating {
    target: string;
    rating: number;
}
export interface BestMatch {
    ratings: Rating[];
    bestMatch: Rating;
    bestMatchIndex: number;
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 20:08:00 GMT
 * Dependencies: none

# Credits
These definitions were written by [ragtime](https://github.com/ragtime), [BendingBender](https://github.com/BendingBender), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).

---
_Source: https://npm.io/package/@types/string-similarity · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
