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

Commit fe53f26

Browse files
committed
fix: use class is function on ipns
1 parent 9a37ac0 commit fe53f26

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/core/ipns/publisher.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class IpnsPublisher {
5151
}
5252

5353
_putRecordToRouting (record, peerId, callback) {
54-
if (!(peerId instanceof PeerId)) {
54+
if (!(PeerId.isPeerId(peerId))) {
5555
const errMsg = `peerId received is not valid`
5656

5757
log.error(errMsg)
@@ -90,7 +90,7 @@ class IpnsPublisher {
9090
}
9191

9292
_publishEntry (key, entry, peerId, callback) {
93-
if (!(key instanceof Key)) {
93+
if (!(Key.isKey(key))) {
9494
const errMsg = `datastore key does not have a valid format`
9595

9696
log.error(errMsg)
@@ -123,7 +123,7 @@ class IpnsPublisher {
123123
}
124124

125125
_publishPublicKey (key, publicKey, peerId, callback) {
126-
if (!(key instanceof Key)) {
126+
if ((!Key.isKey(key))) {
127127
const errMsg = `datastore key does not have a valid format`
128128

129129
log.error(errMsg)
@@ -163,7 +163,7 @@ class IpnsPublisher {
163163
// Returns the record this node has published corresponding to the given peer ID.
164164
// If `checkRouting` is true and we have no existing record, this method will check the routing system for any existing records.
165165
_getPublished (peerId, options, callback) {
166-
if (!(peerId instanceof PeerId)) {
166+
if (!(PeerId.isPeerId(peerId))) {
167167
const errMsg = `peerId received is not valid`
168168

169169
log.error(errMsg)
@@ -216,7 +216,7 @@ class IpnsPublisher {
216216
}
217217

218218
_updateOrCreateRecord (privKey, value, validity, peerId, callback) {
219-
if (!(peerId instanceof PeerId)) {
219+
if (!(PeerId.isPeerId(peerId))) {
220220
const errMsg = `peerId received is not valid`
221221

222222
log.error(errMsg)

src/core/ipns/republisher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class IpnsRepublisher {
151151
}
152152

153153
_getPreviousValue (peerId, callback) {
154-
if (!(peerId instanceof PeerId)) {
154+
if (!(PeerId.isPeerId(peerId))) {
155155
const errMsg = `peerId received is not valid`
156156

157157
log.error(errMsg)

0 commit comments

Comments
 (0)