move static isValid next to instance isValid

...to be easier for developers to parse and distinguish
This commit is contained in:
Ryan X. Charles 2014-08-28 20:27:45 -07:00
parent 5313085773
commit 80625fdbef
1 changed files with 9 additions and 9 deletions

View File

@ -10,15 +10,6 @@ function Address(obj) {
this.set(obj); this.set(obj);
}; };
Address.isValid = function(addrstr) {
try {
var address = new Address().fromString(addrstr);
} catch (e) {
return false;
}
return address.isValid();
};
Address.prototype.set = function(obj) { Address.prototype.set = function(obj) {
this.hashbuf = obj.hashbuf || this.hashbuf || null; this.hashbuf = obj.hashbuf || this.hashbuf || null;
this.networkstr = obj.networkstr || this.networkstr || 'mainnet'; this.networkstr = obj.networkstr || this.networkstr || 'mainnet';
@ -60,6 +51,15 @@ Address.prototype.fromString = function(str) {
return this; return this;
} }
Address.isValid = function(addrstr) {
try {
var address = new Address().fromString(addrstr);
} catch (e) {
return false;
}
return address.isValid();
};
Address.prototype.isValid = function() { Address.prototype.isValid = function() {
try { try {
this.validate(); this.validate();