Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use class-is for type checks #182

Merged
merged 2 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,41 @@
"homepage": "https://github.com/libp2p/js-libp2p",
"dependencies": {
"async": "^2.6.0",
"libp2p-floodsub": "^0.14.1",
"libp2p-ping": "~0.6.1",
"libp2p-switch": "~0.37.3",
"mafmt": "^4.0.0",
"multiaddr": "^3.1.0",
"peer-book": "~0.5.4",
"peer-id": "~0.10.6",
"peer-info": "~0.11.6"
"libp2p-floodsub": "^0.15.0",
"libp2p-ping": "~0.7.0",
"libp2p-switch": "~0.39.0",
"mafmt": "^6.0.0",
"multiaddr": "^4.0.0",
"peer-book": "~0.7.0",
"peer-id": "~0.10.7",
"peer-info": "~0.14.0"
},
"devDependencies": {
"aegir": "^13.0.6",
"chai": "^4.1.2",
"cids": "~0.5.3",
"dirty-chai": "^2.0.1",
"electron-webrtc": "~0.3.0",
"libp2p-circuit": "~0.1.5",
"libp2p-kad-dht": "~0.9.0",
"libp2p-mdns": "~0.9.2",
"libp2p-mplex": "~0.6.0",
"libp2p-railing": "~0.7.1",
"libp2p-secio": "~0.9.4",
"libp2p-spdy": "~0.11.0",
"libp2p-tcp": "~0.11.6",
"libp2p-circuit": "~0.2.0",
"libp2p-kad-dht": "~0.10.0",
"libp2p-mdns": "~0.11.0",
"libp2p-mplex": "~0.7.0",
"libp2p-railing": "~0.8.0",
"libp2p-secio": "~0.10.0",
"libp2p-spdy": "~0.12.1",
"libp2p-tcp": "~0.12.0",
"libp2p-webrtc-star": "~0.13.4",
"libp2p-websockets": "~0.10.5",
"libp2p-websocket-star": "~0.7.7",
"libp2p-websockets": "~0.11.0",
"libp2p-websocket-star": "~0.8.0",
"libp2p-websocket-star-rendezvous": "~0.2.3",
"lodash.times": "^4.3.2",
"pre-commit": "^1.2.2",
"pull-goodbye": "0.0.2",
"pull-serializer": "~0.3.2",
"pull-stream": "^3.6.7",
"safe-buffer": "^5.1.1",
"sinon": "^4.4.10",
"wrtc": "0.0.67"
"sinon": "^4.5.0",
"wrtc": "0.1.1"
},
"contributors": [
"Chris Bratlien <chrisbratlien@gmail.com>",
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down