From a0613c539ba1beea02b527783ade13959199bfdc Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Thu, 13 Feb 2020 16:08:17 +0000 Subject: [PATCH] fix: remove use of assert module (#88) The polyfill is big, we can simulate it by throwing an Error and it doesn't work under React Native. --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 21e918e..e199e83 100644 --- a/src/index.js +++ b/src/index.js @@ -3,12 +3,13 @@ const PeerId = require('peer-id') const { ensureMultiaddr } = require('./utils') const MultiaddrSet = require('./multiaddr-set') -const assert = require('assert') // Peer represents a peer on the IPFS network class PeerInfo { constructor (peerId) { - assert(peerId, 'Missing peerId. Use Peer.create() to create one') + if (!peerId) { + throw new Error('Missing peerId. Use Peer.create() to create one') + } this.id = peerId this.multiaddrs = new MultiaddrSet()