fix: remove use of assert module (#123)

The polyfill is big, we can simulate it by throwing an Error and it doesn't work under React Native.
This commit is contained in:
Alex Potsides 2020-02-14 13:13:03 +00:00 committed by GitHub
parent 86db568cd8
commit 62728769d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,6 @@ const createListener = require('./listener')
const { multiaddrToNetConfig } = require('./utils')
const { AbortError } = require('abortable-iterator')
const { CODE_CIRCUIT, CODE_P2P } = require('./constants')
const assert = require('assert')
/**
* @class TCP
@ -22,7 +21,9 @@ class TCP {
* @param {Upgrader} options.upgrader
*/
constructor ({ upgrader }) {
assert(upgrader, 'An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.')
if (!upgrader) {
throw new Error('An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.')
}
this._upgrader = upgrader
}