tiny-levenshtein
A tiny implementation of the Levenshtein edit distance algorithm.
Last updated a year ago by fabiospampinato .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install tiny-levenshtein 
SYNC missed versions from official npm registry.

Tiny Levenshtein

A tiny implementation of the Levenshtein edit distance algorithm.

Install

npm install tiny-levenshtein

Usage

import levenshtein from 'tiny-levenshtein';

// Let's compute the Levenshtein edit distance between two strings
// Strings are compared at the byte level

levenshtein ( '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 too

levenshtein ( [1, 2, 3], [1, 4, 3] ); // => 1
levenshtein ( [...'????'], [...'????'] ); // => 1

License

MIT © Fabio Spampinato

Current Tags

  • 1.0.1                                ...           latest (a year ago)

2 Versions

  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |