JS: Add Amount.set_currency().

This commit is contained in:
Arthur Britto
2012-11-26 13:06:48 -08:00
parent e406c0f827
commit 67ce14e93f

View File

@@ -388,6 +388,18 @@ Amount.prototype.currency = function() {
return this._currency;
};
Amount.prototype.set_currency = function(c) {
if ('string' === typeof c) {
this._currency.parse_json(c);
}
else
{
c.copyTo(this._currency);
}
return this;
};
// Only checks the value. Not the currency and issuer.
Amount.prototype.is_valid = function() {
return !isNaN(this._value);