New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

suggest-it

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

suggest-it - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

LICENCE

17

lib/levenstein_distance.js
module.exports = distance;
function distance(a, b) {
var table = [];
var table = [], diag = 0, left, top;
if (a.length === 0 || b.length === 0) return Math.max(a.length, b.length);
for (var ii = 0, ilen = a.length + 1; ii !== ilen; ++ii) {
table[ii] = [];
for (var jj = 0, jlen = b.length + 1; jj !== jlen; ++jj) {
if (ii === 0 || jj === 0) table[ii][jj] = Math.max(ii, jj);
if (ii === 0 || jj === 0) table[jj] = Math.max(ii, jj);
else {
var diagPenalty = Number(a[ii-1] !== b[jj-1]);
var diag = table[ii - 1][jj - 1] + diagPenalty;
var top = table[ii - 1][jj] + 1;
var left = table[ii][jj - 1] + 1;
table[ii][jj] = Math.min(left, top, diag);
diag += Number(a[ii-1] !== b[jj-1]);
left = table[jj - 1] + 1;
top = table[jj] + 1;
table[jj] = Math.min(left, top, diag);
diag = top - 1;
}
}
}
return table[a.length][b.length];
return table[b.length];
}

@@ -5,3 +5,3 @@ {

"description": "Given a dictionary, give spelling suggestions. ",
"version": "0.0.1",
"version": "0.0.2",
"homepage": "https://github.com/CrypticSwarm/suggest-it",

@@ -13,6 +13,4 @@ "repository": {

"main": "lib/suggest-it.js",
"licence": "MIT",
"scripts": { "test": "tap test/*.js" },
"engines": {
"node": "~0.6.9"
},
"dependencies": {},

@@ -19,0 +17,0 @@ "devDependencies": { "tap": "~0.2.3" },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc