JSPM

levenshteinjs

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q25040F
  • License

Calculate the Levenshtein distance between two strings.

Package Exports

  • levenshteinjs
  • levenshteinjs/levenshtein.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (levenshteinjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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