mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
JS: Add is_valid() for UInt160 and Currency.
This commit is contained in:
committed by
Stefan Thomas
parent
85914f38ce
commit
51c0782369
@@ -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";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user