string-compare-diff
Advanced tools
Comparing version 0.0.2 to 0.0.3
25
app.js
@@ -8,15 +8,16 @@ 'use strict' | ||
*/ | ||
const strSimilarity = (s1, s2) => { | ||
var longer = s1 | ||
var shorter = s2 | ||
if (s1.length < s2.length) { | ||
longer = s2 | ||
shorter = s1 | ||
module.exports = { | ||
strSimilarity: function(s1, s2){ | ||
var longer = s1 | ||
var shorter = s2 | ||
if (s1.length < s2.length) { | ||
longer = s2 | ||
shorter = s1 | ||
} | ||
var longerLength = longer.length | ||
if (longerLength == 0) { | ||
return 1.0 | ||
} | ||
return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength) | ||
} | ||
var longerLength = longer.length | ||
if (longerLength == 0) { | ||
return 1.0 | ||
} | ||
return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength) | ||
} | ||
@@ -23,0 +24,0 @@ |
{ | ||
"name": "string-compare-diff", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Compare the difference between two strings using distance. Returns a number 0 to 1 showing exactly how related the two strings are.", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
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
1799
47