Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
bounded-levenshtein
Advanced tools
Find the maximum distance between two JavaScript Strings, or Infinity
.
maxDistance
and therefore has maximum running time O(aLength * bLength)
instead of ours, O(max(aLength, bLength) * maxDistance)
.This module's bench.js
is stolen from js-levenshtein.
We ought to steal js-levenshtein's loop-unrolling idea. (It compares four characters at a time.) Right now we're simpler than that.
Benchmarked on 2018-08-27 on an Intel i7-4650U:
bounded-levenshtein (master *>)$ npm run bench
> bounded-levenshtein@0.0.1 bench /home/adam/src/cjworkbench/bounded-levenshtein
> matcha bench.js
50 paragraphs, length max=500 min=240 avr=372.5
326,508 op/s » bounded-levenshtein
100 op/s » js-levenshtein
162,595 op/s » talisman
59 op/s » levenshtein-edit-distance
53 op/s » leven
36 op/s » fast-levenshtein
100 sentences, length max=170 min=6 avr=57.5
62,220 op/s » bounded-levenshtein
1,936 op/s » js-levenshtein
28,112 op/s » talisman
1,191 op/s » levenshtein-edit-distance
1,101 op/s » leven
780 op/s » fast-levenshtein
2000 words, length max=20 min=3 avr=9.5
1,254 op/s » bounded-levenshtein
2,130 op/s » js-levenshtein
1,462 op/s » talisman
1,351 op/s » levenshtein-edit-distance
1,460 op/s » leven
1,208 op/s » fast-levenshtein
Suites: 3
Benches: 18
Elapsed: 18,250.62 ms
In short: bounded-levenshtein
runs much faster in the worst case. That makes
it safer to use when you don't know much about what the input will be.
npm install
npm test -- --watch # runs tests continuously
npm run-script build -- --watch # builds continuously
npm run bench # benchmark!
Pick a feature; write a test; make it pass; commit.
version
in package.json
npm install
to update package-lock.json
git commit -am 'vx.x.x && git tag vx.x.x && git push && git push origin vx.x.x
npm publish
FAQs
Super-fast Levenshtein edit distance with a maximum
The npm package bounded-levenshtein receives a total of 1 weekly downloads. As such, bounded-levenshtein popularity was classified as not popular.
We found that bounded-levenshtein demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.