Levenshtein string difference in Javascript.
Levenshtein
also does some neat things like coerce to a number and string
appropriately. So you can compare Levenshtein objects directly! Not to mention
it has specs!
-
new Levenshtein( m, n )
→Levenshtein
- m (
String
): First string. - n (
String
): Second string. - Initialise a new Levenshtein object.
- m (
-
Levenshtein#distance
→Number
- Distance between strings.
-
Levenshtein#inspect()
→String
- Pretty print Levenshtein table.
-
Levenshtein#toString()
→String
- Alias of:
Levenshtein#inspect()
.
- Alias of:
-
Levenshtein#valueOf()
→Number
- Alias of:
Levenshtein#distance
.
- Alias of:
Levenshtein works in both the browser and node.js.
Simply include levenshtein.js
:
<script src="/javascripts/levenshtein.js"></script>
Install via npm:
npm install levenshtein
Or put it in your package.json
:
{ "levenshtein": "~1.0" }
bower install levenshtein
git clone git://github.com/gf3/Levenshtein.git
Levenshtein is UNLICENSED.
Written by Gianni Chiappetta – heavycorp.io