
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
jaro-winkler
Advanced tools
A string similarity function using the Jaro-Winkler distance metric.
A string similarity function using the Jaro-Winkler distance metric. Returns a number between 0 and 1. A 0 being no similarity and a 1 being an exact match.
Read more about it on Wikipedia.
Install in your Node project using npm as usual; npm install jaro-winkler
. It
also works in the browser, just include the source within index.js
in your
project however you prefer. Note that the distance
function will be added to
the global scope if it's not included with a tool like Browserify.
var distance = require('jaro-winkler');
distance('MARTHA', 'MARHTA');
// 0.961
distance('DWAYNE', 'DUANE');
// 0.84
distance('DIXON', 'DICKSONX');
// 0.814
// Case Insensitive
distance('MARTHA', 'MARTHA');
// 1
distance('mArThA', 'MaRtHa', { caseSensitive: false });
// 1
Here's contrived sample of how you might utilize a distance metric in your own app. This shows how you might offer a helpful message when a user fat-fingers a command.
#!/usr/bin/env node
'use strict';
var distance = require('jaro-winkler');
var commands = ['open', 'close', 'save', 'revert', 'select', 'copy', 'duplicate', 'add', 'subtract'];
var rated = [];
var args = process.argv.slice(2);
commands.forEach(function(command) {
rated.push({
command: command,
distance: distance(args[0], command)
});
});
rated.sort(function(a, b) {
if (a.distance < b.distance) {
return 1;
} else if (a.distance > b.distance) {
return -1;
} else {
return 0;
}
});
if (rated[0].distance === 1) {
console.log("Running " + rated[0].command + "!");
} else {
console.log("Did you mean " + rated[0].command + "?");
}
process.exit(0);
FAQs
A string similarity function using the Jaro-Winkler distance metric.
The npm package jaro-winkler receives a total of 30,962 weekly downloads. As such, jaro-winkler popularity was classified as popular.
We found that jaro-winkler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.