From bb0c9905ed87da5965e3faf33623e242d0bb26da Mon Sep 17 00:00:00 2001 From: Diogo Silva Date: Tue, 3 Apr 2018 15:51:05 +0100 Subject: [PATCH] feat: use class-is for type checks --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 3498bab787..bdddea1d77 100644 --- a/src/index.js +++ b/src/index.js @@ -10,6 +10,7 @@ const series = require('async/series') const PeerBook = require('peer-book') const Switch = require('libp2p-switch') const Ping = require('libp2p-ping') +const WebSockets = require('libp2p-websockets') const peerRouting = require('./peer-routing') const contentRouting = require('./content-routing') @@ -129,8 +130,7 @@ class Node extends EventEmitter { if (transport.filter(multiaddrs).length > 0) { this.switch.transport.add( transport.tag || transport.constructor.name, transport) - } else if (transport.constructor && - transport.constructor.name === 'WebSockets') { + } else if (WebSockets.isWebSockets(transport)) { // TODO find a cleaner way to signal that a transport is always // used for dialing, even if no listener ws = transport