Comparing version 4.0.0 to 4.0.1
16
index.js
@@ -177,7 +177,13 @@ /* | ||
var self = this | ||
function compare (a, b) { | ||
return self.distance(a.id, id) - self.distance(b.id, id) | ||
} | ||
return contacts.sort(compare).slice(0, n) | ||
return contacts | ||
.map(function (a) { | ||
return [self.distance(a.id, id), a] | ||
}) | ||
.sort(function (a, b) { | ||
return a[0] - b[0] | ||
}) | ||
.slice(0, n) | ||
.map(function (a) { | ||
return a[1] | ||
}) | ||
} | ||
@@ -184,0 +190,0 @@ |
{ | ||
"name": "k-bucket", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Kademlia DHT K-bucket implementation as a binary tree", | ||
@@ -32,2 +32,3 @@ "keywords": [ | ||
"benchmark:add": "node benchmarks/add.js", | ||
"benchmark:closest": "node benchmarks/closest.js", | ||
"benchmark:distance": "node benchmarks/distance.js", | ||
@@ -45,6 +46,6 @@ "coverage": "nyc tape test/*.js", | ||
"buffer-equals": "^1.0.3", | ||
"nyc": "^11.4.1", | ||
"standard": "^11.0.0", | ||
"nyc": "^11.7.3", | ||
"standard": "^11.0.1", | ||
"tape": "^4.5.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55095
19
947
2