mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
JS: Add a way to convert an amount to a number.
This commit is contained in:
@@ -353,6 +353,12 @@ Amount.prototype.issuer = function() {
|
||||
return this._issuer;
|
||||
};
|
||||
|
||||
Amount.prototype.to_number = function(allow_nan) {
|
||||
var s = this.to_text(allow_nan);
|
||||
|
||||
return ('string' === typeof s) ? Number(s) : s;
|
||||
}
|
||||
|
||||
// Convert only value to JSON wire format.
|
||||
Amount.prototype.to_text = function(allow_nan) {
|
||||
if (isNaN(this._value)) {
|
||||
|
||||
Reference in New Issue
Block a user