Add valid check methods
This commit is contained in:
parent
08ea798d53
commit
149f8bd9f5
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue