From 149f8bd9f541940ca4602a872584832cf5d0b0f8 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sat, 13 Jan 2018 08:57:54 -0700 Subject: [PATCH] Add valid check methods --- core/ftn_address.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/ftn_address.js b/core/ftn_address.js index 9edb3819..f0936e1d 100644 --- a/core/ftn_address.js +++ b/core/ftn_address.js @@ -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);