levenshteinjs
v0.0.2
Published
Calculate the Levenshtein distance between two strings.
Downloads
3
Maintainers
Readme
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