mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-06-27 08:21:48 +00:00
feat: deprecate isEqual in favor of equals (#107)
This commit is contained in:
17
src/index.js
17
src/index.js
@ -133,7 +133,12 @@ class PeerId {
|
||||
return this._idCIDString
|
||||
}
|
||||
|
||||
isEqual (id) {
|
||||
/**
|
||||
* Checks the equality of `this` peer against a given PeerId.
|
||||
* @param {Buffer|PeerId} id
|
||||
* @returns {boolean}
|
||||
*/
|
||||
equals (id) {
|
||||
if (Buffer.isBuffer(id)) {
|
||||
return this.id.equals(id)
|
||||
} else if (id.id) {
|
||||
@ -143,6 +148,16 @@ class PeerId {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the equality of `this` peer against a given PeerId.
|
||||
* @deprecated Use `.equals`
|
||||
* @param {Buffer|PeerId} id
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isEqual (id) {
|
||||
return this.equals(id)
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if this PeerId instance is valid (privKey -> pubKey -> Id)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user