Add valid check methods
This commit is contained in:
@@ -20,6 +20,15 @@ module.exports = class Address {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isValidAddress(addr) {
|
||||||
|
return addr && addr.isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
isValid() {
|
||||||
|
// FTN address is valid if we have at least a net/node
|
||||||
|
return _.isNumber(this.net) && _.isNumber(this.node);
|
||||||
|
}
|
||||||
|
|
||||||
isEqual(other) {
|
isEqual(other) {
|
||||||
if(_.isString(other)) {
|
if(_.isString(other)) {
|
||||||
other = Address.fromString(other);
|
other = Address.fromString(other);
|
||||||
|
|||||||
Reference in New Issue
Block a user