Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 691283d

Browse files
Alan Shawmkg20001
andcommitted
refactor: use sane .indexOf check
Co-Authored-By: mkg20001 <[email protected]>
1 parent 5bc0765 commit 691283d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/core/runtime/libp2p-browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Node extends libp2p {
1414
constructor (_options) {
1515
const wrtcstar = new WebRTCStar({ id: _options.peerInfo.id })
1616

17-
const wsstarServers = _options.peerInfo.multiaddrs.toArray().map(String).filter(addr => ~addr.indexOf('p2p-websocket-star'))
17+
const wsstarServers = _options.peerInfo.multiaddrs.toArray().map(String).filter(addr => addr.includes('p2p-websocket-star'))
1818
_options.peerInfo.multiaddrs.replace(wsstarServers.map(multiaddr), '/p2p-websocket-star') // the ws-star-multi module will replace this with the chosen ws-star servers
1919
const wsstar = new WebSocketStarMulti({ servers: wsstarServers, id: _options.peerInfo.id, ignore_no_online: !wsstarServers.length || _options.wsStarIgnoreErrors })
2020

src/core/runtime/libp2p-nodejs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const multiaddr = require('multiaddr')
1414

1515
class Node extends libp2p {
1616
constructor (_options) {
17-
const wsstarServers = _options.peerInfo.multiaddrs.toArray().map(String).filter(addr => ~addr.indexOf('p2p-websocket-star'))
17+
const wsstarServers = _options.peerInfo.multiaddrs.toArray().map(String).filter(addr => addr.includes('p2p-websocket-star'))
1818
_options.peerInfo.multiaddrs.replace(wsstarServers.map(multiaddr), '/p2p-websocket-star') // the ws-star-multi module will replace this with the chosen ws-star servers
1919
const wsstar = new WebSocketStarMulti({ servers: wsstarServers, id: _options.peerInfo.id, ignore_no_online: !wsstarServers.length || _options.wsStarIgnoreErrors })
2020

0 commit comments

Comments
 (0)