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

string-similarity

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-similarity - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

8

package.json
{
"name": "string-similarity",
"version": "4.0.2",
"version": "4.0.3",
"description": "Finds degree of similarity between strings, based on Dice's Coefficient, which is mostly better than Levenshtein distance.",

@@ -35,6 +35,6 @@ "main": "src/index.js",

"devDependencies": {
"jasmine": "^3.6.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
"jasmine": "^3.6.3",
"webpack": "^5.4.0",
"webpack-cli": "^4.2.0"
}
}

@@ -28,2 +28,3 @@ string-similarity

- [4.0.2](#402)
- [4.0.3](#403)

@@ -160,4 +161,7 @@

### 4.0.3
* Make compatible with IE and ES5. Also, update deps. (see [PR56](https://github.com/aceakash/string-similarity/pull/56))
![Build status](https://codeship.com/projects/2aa453d0-0959-0134-8a76-4abcb29fe9b4/status?branch=master)
[![Known Vulnerabilities](https://snyk.io/test/github/aceakash/string-similarity/badge.svg)](https://snyk.io/test/github/aceakash/string-similarity)
module.exports = {
compareTwoStrings,
findBestMatch
compareTwoStrings:compareTwoStrings,
findBestMatch:findBestMatch
};

@@ -60,3 +60,3 @@

return { ratings, bestMatch, bestMatchIndex };
return { ratings: ratings, bestMatch: bestMatch, bestMatchIndex: bestMatchIndex };
}

@@ -68,4 +68,4 @@

if (!targetStrings.length) return false;
if (targetStrings.find(s => typeof s !== 'string')) return false;
if (targetStrings.find( function (s) { return typeof s !== 'string'})) return false;
return true;
}

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.stringSimilarity=e():t.stringSimilarity=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e){function n(t,e){if(t=t.replace(/\s+/g,""),e=e.replace(/\s+/g,""),!t.length&&!e.length)return 1;if(!t.length||!e.length)return 0;if(t===e)return 1;if(1===t.length&&1===e.length)return 0;if(t.length<2||e.length<2)return 0;let n=new Map;for(let e=0;e<t.length-1;e++){const r=t.substring(e,e+2),o=n.has(r)?n.get(r)+1:1;n.set(r,o)}let r=0;for(let t=0;t<e.length-1;t++){const o=e.substring(t,t+2),i=n.has(o)?n.get(o):0;i>0&&(n.set(o,i-1),r++)}return 2*r/(t.length+e.length-2)}t.exports={compareTwoStrings:n,findBestMatch:function(t,e){if(!function(t,e){return"string"==typeof t&&(!!Array.isArray(e)&&(!!e.length&&!e.find(t=>"string"!=typeof t)))}(t,e))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const r=[];let o=0;for(let i=0;i<e.length;i++){const u=e[i],f=n(t,u);r.push({target:u,rating:f}),f>r[o].rating&&(o=i)}const i=r[o];return{ratings:r,bestMatch:i,bestMatchIndex:o}}}}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.stringSimilarity=e():t.stringSimilarity=e()}(self,(function(){return t={138:t=>{function e(t,e){if(t=t.replace(/\s+/g,""),e=e.replace(/\s+/g,""),!t.length&&!e.length)return 1;if(!t.length||!e.length)return 0;if(t===e)return 1;if(1===t.length&&1===e.length)return 0;if(t.length<2||e.length<2)return 0;let n=new Map;for(let e=0;e<t.length-1;e++){const r=t.substring(e,e+2),o=n.has(r)?n.get(r)+1:1;n.set(r,o)}let r=0;for(let t=0;t<e.length-1;t++){const o=e.substring(t,t+2),s=n.has(o)?n.get(o):0;s>0&&(n.set(o,s-1),r++)}return 2*r/(t.length+e.length-2)}t.exports={compareTwoStrings:e,findBestMatch:function(t,n){if(!function(t,e){return"string"==typeof t&&!!Array.isArray(e)&&!!e.length&&!e.find((function(t){return"string"!=typeof t}))}(t,n))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const r=[];let o=0;for(let s=0;s<n.length;s++){const i=n[s],g=e(t,i);r.push({target:i,rating:g}),g>r[o].rating&&(o=s)}return{ratings:r,bestMatch:r[o],bestMatchIndex:o}}}}},e={},function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.exports}(138);var t,e}));
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