0.0.2 • Published 2 years ago

levenshteinjs v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

Levenshtein distance

Calculate the Levenshtein distance between two strings.

The Levenshtein distance between two strings is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one string into the other.

Demo

https://lab.miguelmota.com/levenshtein

Install

npm install levenshteinjs

Usage

const levenshteinDistance = require('levenshteinjs');

console.log(levenshteinDistance('foo', 'foo')) // 0
console.log(levenshteinDistance('foo', 'fob')) // 1
console.log(levenshteinDistance('flaw', 'lawn')) // 2
console.log(levenshteinDistance('kitten', 'sitting')) // 3

Test

npm test

License

MIT