feat: deprecate isEqual in favor of equals (#107)

This commit is contained in:
Jacob Heun
2019-11-12 15:00:11 +01:00
committed by Vasco Santos
parent 4fbf859efc
commit bbf0416f08
3 changed files with 44 additions and 2 deletions

View File

@ -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)
*/