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

@acusti/matchmaking

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

@acusti/matchmaking - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

11

dist/index.js

@@ -6,3 +6,4 @@ const FIRST_NUMBER = '0'.charCodeAt(0);

const MAX_DISTANCE = 15;
const MAX_INEXACT_SCORE = 0.999999;
const MAX_INEXACT_SCORE = 0.99999;
const MAX_PARTIAL_EXACT_SCORE = 0.999999;
export const getMatchScore = (strA, strB, isSanitized) => {

@@ -13,2 +14,3 @@ if (!isSanitized) {

}
// Exact match scores 1
if (strA === strB)

@@ -19,2 +21,6 @@ return 1;

const shortestLength = Math.min(strALength, strBLength);
// Exact partial match is next best score to exact match
if (strA.slice(0, shortestLength) === strB.slice(0, shortestLength)) {
return MAX_PARTIAL_EXACT_SCORE;
}
// To proportionally weight consecutive exact matches, increase bonus relative to total length

@@ -51,4 +57,5 @@ const bonusMultiplier = Math.min(0.25, 3 / shortestLength);

// If score came out at 0 or less, give it best possible score for an inexact match
if (score <= 0)
if (score <= 0) {
return MAX_INEXACT_SCORE;
}
score = (worstPossibleScore - score) / worstPossibleScore;

@@ -55,0 +62,0 @@ // Don’t allow an inexact match to get a score of 1 (reserved for an exact match)

9

package.json
{
"name": "@acusti/matchmaking",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"exports": "./dist/index.js",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"engines": {
"node": ">=12"
},
"files": [

@@ -9,0 +12,0 @@ "dist"

Sorry, the diff of this file is not supported yet

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