JS: Add is_valid() for UInt160 and Currency.

This commit is contained in:
Arthur Britto
2012-11-23 18:30:43 -08:00
committed by Stefan Thomas
parent 85914f38ce
commit 51c0782369

View File

@@ -217,6 +217,10 @@ UInt160.prototype.to_json = function () {
return output;
};
UInt160.prototype.is_valid = function () {
return !isNaN(this_value);
};
// XXX Internal form should be UInt160.
var Currency = function () {
// Internal form: 0 = XRP. 3 letter-code.
@@ -272,6 +276,10 @@ Currency.prototype.parse_json = function(j) {
return this;
};
Currency.prototype.is_valid = function () {
return !isNaN(this_value);
};
Currency.prototype.to_json = function () {
return this._value ? this._value : "XRP";
};