Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createGraph = require('ngraph.graph')
const ForceGraph = require('force-graph').default
const { addPeer: _addPeer, removePeer: _removePeer, findPeer } = require('../tests/helpers/peers')
const { nodesToArray } = require('../tests/helpers/graph')
const MAX_PEERS = 2
const TOPIC = Buffer.from('batman')
const graph = createGraph()
const peersTitle = document.getElementById('peers-title')
const connectionsTitle = document.getElementById('connections-title')
const addPeer = () => _addPeer(graph, TOPIC, {
bootstrap: ['http://localhost:4000']
})
const removePeer = (id) => _removePeer(graph, id)
const addMany = n => [...Array(n).keys()].forEach(() => addPeer())
const deleteMany = n => [...Array(n).keys()].forEach(() => removePeer())