# fast-levenshtein

> Efficient implementation of Levenshtein algorithm with locale-specific collator support.

Latest version **3.0.0** (published 2020-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install fast-levenshtein
pnpm add fast-levenshtein
yarn add fast-levenshtein
bun add fast-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 | 3.0.0 |
| Published | 2020-07-22 |
| First published | 2013-04-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/fast-levenshtein) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 613 |
| Author | Ramesh Nair |
| Maintainers | hiddentao |
| Keywords | levenshtein, distance, string |

## Links

- npm: https://www.npmjs.com/package/fast-levenshtein
- Repository: https://github.com/hiddentao/fast-levenshtein
- Homepage: https://github.com/hiddentao/fast-levenshtein#readme
- Issues: https://github.com/hiddentao/fast-levenshtein/issues
- npm.io page: https://npm.io/package/fast-levenshtein

## Dependencies (1)

- [fastest-levenshtein](https://npm.io/package/fastest-levenshtein.md) ^1.0.7

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2020-07-22
- 2.0.6 — 2016-12-27
- 2.0.5 — 2016-09-28
- 2.0.4 — 2016-09-07
- 2.0.3 — 2016-08-26
- 2.0.2 — 2016-08-26
- 2.0.1 — 2016-08-26
- 2.0.0 — 2016-08-26
- 1.1.4 — 2016-07-22
- 1.1.3 — 2016-01-26
- 1.1.2 — 2016-01-26
- 1.1.0 — 2015-12-29
- 1.0.7 — 2015-08-13
- 1.0.6 — 2014-12-17
- 1.0.5 — 2014-12-06
- … 5 more at https://npm.io/package/fast-levenshtein/versions

## README

# fast-levenshtein - Levenshtein algorithm in Javascript

[![Build Status](https://secure.travis-ci.org/hiddentao/fast-levenshtein.png)](http://travis-ci.org/hiddentao/fast-levenshtein)
[![NPM module](https://badge.fury.io/js/fast-levenshtein.png)](https://badge.fury.io/js/fast-levenshtein)
[![NPM downloads](https://img.shields.io/npm/dm/fast-levenshtein.svg?maxAge=2592000)](https://www.npmjs.com/package/fast-levenshtein)
[![Follow on Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/hiddentao)

A Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with locale-specific collator support. This uses [fastest-levenshtein](https://github.com/ka-weihe/fastest-levenshtein) under the hood.

## Features

* Works in node.js and in the browser.
* Locale-sensitive string comparisons if needed.
* Comprehensive test suite.

## Installation

```bash
$ npm install fast-levenshtein
```
**CDN**

The latest version is now also always available at https://npm-cdn.com/pkg/fast-levenshtein/ 

## Examples

**Default usage**

```javascript
var levenshtein = require('fast-levenshtein');

var distance = levenshtein.get('back', 'book');   // 2
var distance = levenshtein.get('我愛你', '我叫你');   // 1
```

**Locale-sensitive string comparisons**

It supports using [Intl.Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) for locale-sensitive  string comparisons:

```javascript
var levenshtein = require('fast-levenshtein');

levenshtein.get('mikailovitch', 'Mikhaïlovitch', { useCollator: true});
// 1
```

## Building and Testing

To build the code and run the tests:

```bash
$ npm install -g grunt-cli
$ npm install
$ npm run build
```

## Performance

This uses [fastest-levenshtein](https://github.com/ka-weihe/fastest-levenshtein) under the hood.

## Contributing

If you wish to submit a pull request please update and/or create new tests for any changes you make and ensure the grunt build passes.

See [CONTRIBUTING.md](https://github.com/hiddentao/fast-levenshtein/blob/master/CONTRIBUTING.md) for details.

## License

MIT - see [LICENSE.md](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md)

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