https://github.com/fabiospampinato/tiny-levenshtein
A tiny implementation of the Levenshtein edit distance algorithm.
https://github.com/fabiospampinato/tiny-levenshtein
distance edit levenshtein tiny
Last synced: 3 months ago
JSON representation
A tiny implementation of the Levenshtein edit distance algorithm.
- Host: GitHub
- URL: https://github.com/fabiospampinato/tiny-levenshtein
- Owner: fabiospampinato
- License: mit
- Created: 2022-06-21T17:14:27.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-24T16:28:51.000Z (about 2 years ago)
- Last Synced: 2024-11-01T12:17:16.331Z (12 months ago)
- Topics: distance, edit, levenshtein, tiny
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Tiny Levenshtein
A tiny implementation of the Levenshtein edit distance algorithm.
## Install
```sh
npm install tiny-levenshtein
```## Usage
```ts
import levenshtein from 'tiny-levenshtein';// Let's compute the Levenshtein edit distance between two strings
// Strings are compared at the byte levellevenshtein ( 'kitten', 'sitting' ); // => 3
levenshtein ( '🤣', '😂' ); // => 2// Let's compute the Levenshtein edit distance between two arrays
// Arrays are compared at the element level
// This can double-down as Unicode-aware string comparison toolevenshtein ( [1, 2, 3], [1, 4, 3] ); // => 1
levenshtein ( [...'🤣'], [...'😂'] ); // => 1
```## License
MIT © Fabio Spampinato