Socket
Socket
Sign inDemoInstall

k-bucket

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

k-bucket - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

benchmarks/closest.js

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"
}
}
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