move static isValid next to instance isValid
...to be easier for developers to parse and distinguish
This commit is contained in:
parent
5313085773
commit
80625fdbef
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue