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

Commit

Permalink
fix: better verifications on create()
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <[email protected]>
  • Loading branch information
hacdias committed Oct 30, 2018
1 parent 149c83b commit b20d969
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class PeerInfo {
}

PeerInfo.create = async (peerId) => {
if (typeof peerId === 'undefined') {
if (peerId == null) {
peerId = await PeerId.create()
} else if (peerId && typeof peerId.toJSON !== 'function') {
} else if (!PeerId.isPeerId(peerId)) {
peerId = await PeerId.createFromJSON(peerId)
}

Expand Down

0 comments on commit b20d969

Please sign in to comment.