New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

association

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

association - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

34

index.js

@@ -5,2 +5,36 @@ var association = function (config) {

};
association.prototype.getRecommendations = function(simObj,map,myMap) {
var total = {};
var simTotal = {};
var rankings = [];
for (var key in simObj) {
if (simObj[key].score >= 0) {
for (var x in map[simObj[key].key]) {
if (!myMap[x]) {
console.log('This happened?')
total[x] = total[x] || 0
simTotal[x] = simTotal[x] || 0
total[x] += map[simObj[key].key][x] * simObj[key].score
simTotal[x]+= simObj[key].score
}
}
}
}
for (var y in total) {
console.log(total[y] / simTotal[y])
rankings.push({key: y, score: total[y] / simTotal[y]})
}
rankings.sort(function (a, b) {
if (a.score > b.score) {
return 1;
}
if (a.score < b.score) {
return -1;
}
// a must be equal to b
return 0;
});
rankings.reverse();
return rankings;
}
association.prototype.compareAll = function (n, map, myMap) {

@@ -7,0 +41,0 @@ var ar = [];

2

package.json
{
"name": "association",
"version": "1.0.2",
"version": "1.0.3",
"description": "An association lib that will find an things closest associations and give helper methods to do some other interesting things",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,3 +7,3 @@ var blah = require('./index.js')

movieOne:4.1,
movieTwo:1,
movieTwo:1.7,
movieThree:5,

@@ -13,12 +13,17 @@ mblah:2.4

var alec = {
movieOne:1.1,
movieTwo:3,
movieOne:4,
movieTwo:1,
movieThree:4,
mblah:4
mblah:4,
movi:5,
mov2:6
};
var randy = {
movieOne:3,
movieTwo:2,
movieOne:5,
movieTwo:5,
movieThree:5,
mblah:4
mblah:2,
movi:3.9,
mov2:5,
mov3:6
};

@@ -29,3 +34,4 @@ var obj = {

}
console.log(a.compareAll(2,obj,jordan));
console.log(a.getRecommendations(a.compareAll(2,obj,jordan),obj,jordan))
console.log();

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