Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string-compare-diff

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-compare-diff - npm Package Compare versions

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",

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