From 67ce14e93fe00aa7faced79af9349da24c8a9acd Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Mon, 26 Nov 2012 13:06:48 -0800 Subject: [PATCH] JS: Add Amount.set_currency(). --- src/js/amount.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/js/amount.js b/src/js/amount.js index 423affa415..394574a315 100644 --- a/src/js/amount.js +++ b/src/js/amount.js @@ -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);