libp2p-kad-dht
Advanced tools
Comparing version 0.18.4 to 0.18.5
@@ -0,1 +1,11 @@ | ||
<a name="0.18.5"></a> | ||
## [0.18.5](https://github.com/libp2p/js-libp2p-kad-dht/compare/v0.18.4...v0.18.5) (2020-02-14) | ||
### Bug Fixes | ||
* remove use of assert module ([#173](https://github.com/libp2p/js-libp2p-kad-dht/issues/173)) ([de85eb6](https://github.com/libp2p/js-libp2p-kad-dht/commit/de85eb6)) | ||
<a name="0.18.4"></a> | ||
@@ -2,0 +12,0 @@ ## [0.18.4](https://github.com/libp2p/js-libp2p-kad-dht/compare/v0.18.3...v0.18.4) (2020-02-05) |
{ | ||
"name": "libp2p-kad-dht", | ||
"version": "0.18.4", | ||
"version": "0.18.5", | ||
"description": "JavaScript implementation of the Kad-DHT for libp2p", | ||
@@ -91,2 +91,3 @@ "leadMaintainer": "Vasco Santos <vasco.santos@moxy.studio>", | ||
"Alan Shaw <alan.shaw@protocol.ai>", | ||
"Alex Potsides <alex@achingbrain.net>", | ||
"Blake Byrnes <blakebyrnes@gmail.com>", | ||
@@ -93,0 +94,0 @@ "David Dias <daviddias.p@gmail.com>", |
'use strict' | ||
const assert = require('assert') | ||
const { EventEmitter } = require('events') | ||
@@ -70,4 +69,7 @@ const errcode = require('err-code') | ||
super() | ||
assert(dialer, 'libp2p-kad-dht requires an instance of Dialer') | ||
if (!dialer) { | ||
throw new Error('libp2p-kad-dht requires an instance of Dialer') | ||
} | ||
/** | ||
@@ -74,0 +76,0 @@ * Local reference to the libp2p dialer instance |
'use strict' | ||
const assert = require('assert') | ||
const PeerInfo = require('peer-info') | ||
@@ -24,4 +23,4 @@ const PeerId = require('peer-id') | ||
constructor (type, key, level) { | ||
if (key) { | ||
assert(Buffer.isBuffer(key)) | ||
if (key && !Buffer.isBuffer(key)) { | ||
throw new Error('Key must be a buffer') | ||
} | ||
@@ -28,0 +27,0 @@ |
@@ -6,3 +6,2 @@ 'use strict' | ||
const PeerId = require('peer-id') | ||
const assert = require('assert') | ||
const AbortController = require('abort-controller') | ||
@@ -27,3 +26,5 @@ const errcode = require('err-code') | ||
constructor (dht, options) { | ||
assert(dht, 'Random Walk needs an instance of the Kademlia DHT') | ||
if (!dht) { | ||
throw new Error('Random Walk needs an instance of the Kademlia DHT') | ||
} | ||
@@ -30,0 +31,0 @@ this._kadDHT = dht |
@@ -11,3 +11,2 @@ /* eslint-env mocha */ | ||
const { defaultRandomWalk } = require('../src/constants') | ||
const { AssertionError } = require('assert') | ||
@@ -39,3 +38,3 @@ const TestDHT = require('./utils/test-dht') | ||
it('should use require a dht', () => { | ||
expect(() => new RandomWalk()).to.throw(AssertionError) | ||
expect(() => new RandomWalk()).to.throw() | ||
}) | ||
@@ -42,0 +41,0 @@ |
Sorry, the diff of this file is not supported yet
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
2027650