# damerau-levenshtein

> Damerau - Levenshtein distance by The Spanish Inquisition + relative distance

Latest version **1.0.8** (published 2022-01-06) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install damerau-levenshtein
pnpm add damerau-levenshtein
yarn add damerau-levenshtein
bun add damerau-levenshtein
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2022-01-06 |
| First published | 2013-08-29 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | separate (@types/damerau-levenshtein) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Author | The Spanish Inquisition |
| Maintainers | lazurski |
| Keywords | Damerau-Levenshtein, Damerau, Levenshtein, distance, compare, relative |

## Links

- npm: https://www.npmjs.com/package/damerau-levenshtein
- Repository: https://github.com/tad-lispy/node-damerau-levenshtein
- Homepage: https://github.com/tad-lispy/node-damerau-levenshtein#readme
- Issues: https://github.com/tad-lispy/node-damerau-levenshtein/issues
- npm.io page: https://npm.io/package/damerau-levenshtein

## Recent versions

- 1.0.8 (latest) — 2022-01-06
- 1.0.7 — 2021-05-05
- 1.0.6 — 2020-01-27
- 1.0.5 — 2019-05-09
- 1.0.4 — 2017-03-24
- 1.0.3 — 2016-09-26
- 1.0.2 — 2016-09-26
- 1.0.1 — 2016-09-11
- 1.0.0 — 2016-02-25
- 0.1.3 — 2013-09-02
- 0.1.2 — 2013-08-29

## README

[![NPM](https://nodei.co/npm/damerau-levenshtein.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/damerau-levenshtein/)

It provides a function that takes two string arguments and returns a hash like this:

``` javascript
{
  steps: 5,       // Levenstein demerau distance
  relative: 0.7,  // steps / length of the longer string
  similarity: 0.3 // 1 - relative
}
```

## Install

```sh
npm install damerau-levenshtein
```

## Use with ES6 modules

```js
import * as levenshtein from 'damerau-levenshtein';

const lev = levenshtein('hello world', 'Hello World!');
// { steps: 4, relative: 0.3076923076923077, similarity: 0.6923076923076923 }
```

Please see [tests](./test/test.js) for more insights.

## Use with TypeScript

```ts
import * as levenshtein from 'damerau-levenshtein';

interface LevenshteinResponse {
  steps: number;
  relative: number;
  similarity: number;
}

const lev: LevenshteinResponse = levenshtein('hello world', 'Hello World!');

console.log(lev.steps);
// 2
console.log(lev.foo);
// TypeScript Error: Property 'foo' does not exist on type 'LevenshteinResponse'.
```

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