Comparing version 3.3.0 to 3.3.1
16
index.js
@@ -149,9 +149,2 @@ /* | ||
var self = this | ||
function sort (contacts) { | ||
return contacts.slice().sort(function (a, b) { | ||
return self.distance(a.id, id) - self.distance(b.id, id) | ||
}) | ||
} | ||
for (var nodes = [ this.root ], bitIndex = 0; nodes.length > 0 && contacts.length < n;) { | ||
@@ -164,7 +157,12 @@ var node = nodes.pop() | ||
} else { | ||
contacts = contacts.concat(sort(node.contacts)).slice(0, n) | ||
contacts = contacts.concat(node.contacts) | ||
} | ||
} | ||
return contacts | ||
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) | ||
} | ||
@@ -171,0 +169,0 @@ |
{ | ||
"name": "k-bucket", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Kademlia DHT K-bucket implementation as a binary tree", | ||
@@ -22,3 +22,4 @@ "keywords": [ | ||
"Kirill Fomichev <fanatid@ya.ru>", | ||
"Robert Kowalski <rok@kowalski.gd>" | ||
"Robert Kowalski <rok@kowalski.gd>", | ||
"Nazar Mokrynskyi <nazar@mokrynskyi.com>" | ||
], | ||
@@ -25,0 +26,0 @@ "main": "./index.js", |
@@ -11,3 +11,3 @@ # k-bucket | ||
[@tristanls](https://github.com/tristanls), [@mikedeboer](https://github.com/mikedeboer), [@deoxxa](https://github.com/deoxxa), [@feross](https://github.com/feross), [@nathanph](https://github.com/nathanph), [@allouis](https://github.com/allouis), [@fanatid](https://github.com/fanatid), [@robertkowalski](https://github.com/robertkowalski) | ||
[@tristanls](https://github.com/tristanls), [@mikedeboer](https://github.com/mikedeboer), [@deoxxa](https://github.com/deoxxa), [@feross](https://github.com/feross), [@nathanph](https://github.com/nathanph), [@allouis](https://github.com/allouis), [@fanatid](https://github.com/fanatid), [@robertkowalski](https://github.com/robertkowalski), [@nazar-pc](https://github.com/nazar-pc) | ||
@@ -14,0 +14,0 @@ ## Installation |
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
53412
18
906