Add valid check methods

This commit is contained in:
Bryan Ashby 2018-01-13 08:57:54 -07:00
parent 08ea798d53
commit 149f8bd9f5
1 changed files with 9 additions and 0 deletions

View File

@ -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) {
if(_.isString(other)) {
other = Address.fromString(other);