Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,3 @@ // intentionally commented out as it makes it slower... | ||
var arr = []; | ||
var charCodeCache = []; | ||
@@ -16,7 +17,7 @@ module.exports = function (a, b) { | ||
if (aLen === 0) { | ||
return b.length; | ||
return bLen; | ||
} | ||
if (bLen === 0) { | ||
return a.length; | ||
return aLen; | ||
} | ||
@@ -32,2 +33,3 @@ | ||
while (i < aLen) { | ||
charCodeCache[i] = a.charCodeAt(i); | ||
arr[i] = ++i; | ||
@@ -42,3 +44,3 @@ } | ||
for (i = 0; i < aLen; i++) { | ||
tmp2 = bCharCode === a.charCodeAt(i) ? tmp : tmp + 1; | ||
tmp2 = bCharCode === charCodeCache[i] ? tmp : tmp + 1; | ||
tmp = arr[i]; | ||
@@ -45,0 +47,0 @@ ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2; |
{ | ||
"name": "leven", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm", | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"ava": "0.0.3", | ||
"ava": "0.0.4", | ||
"fast-levenshtein": "^1.0.3", | ||
@@ -47,0 +47,0 @@ "ld": "^0.1.0", |
@@ -30,10 +30,10 @@ # leven [![Build Status](https://travis-ci.org/sindresorhus/leven.svg?branch=master)](https://travis-ci.org/sindresorhus/leven) | ||
``` | ||
203,025 op/s » leven | ||
46,748 op/s » levenshtein-edit-distance | ||
42,073 op/s » fast-levenshtein | ||
29,508 op/s » levenshtein-component | ||
24,183 op/s » ld | ||
18,065 op/s » levdist | ||
15,022 op/s » natural | ||
11,764 op/s » levenshtein | ||
230,113 op/s » leven | ||
201,026 op/s » levenshtein-edit-distance | ||
40,454 op/s » fast-levenshtein | ||
28,664 op/s » levenshtein-component | ||
22,952 op/s » ld | ||
16,882 op/s » levdist | ||
11,180 op/s » levenshtein | ||
9,624 op/s » natural | ||
``` | ||
@@ -40,0 +40,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3259
62