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

Commit a0613c5

Browse files
authored
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.
1 parent ac8c640 commit a0613c5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
const PeerId = require('peer-id')
44
const { ensureMultiaddr } = require('./utils')
55
const MultiaddrSet = require('./multiaddr-set')
6-
const assert = require('assert')
76

87
// Peer represents a peer on the IPFS network
98
class PeerInfo {
109
constructor (peerId) {
11-
assert(peerId, 'Missing peerId. Use Peer.create() to create one')
10+
if (!peerId) {
11+
throw new Error('Missing peerId. Use Peer.create() to create one')
12+
}
1213

1314
this.id = peerId
1415
this.multiaddrs = new MultiaddrSet()

0 commit comments

Comments
 (0)