From ead47deab7ed27f44a3e10a7b99d7235a4d53f39 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Mon, 11 Mar 2013 14:17:57 +0100 Subject: [PATCH] JS: Fix Currency#is_valid. Currency.is_valid("USD") returned false, because "USD" is NaN (not a Number). We should not use NaN as a stand-in value, since it means "not a *JavaScript* number", whereas our meaning really is "not a BigInteger object". So we should be using null. --- src/js/currency.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/currency.js b/src/js/currency.js index e4a4e305..ab960418 100644 --- a/src/js/currency.js +++ b/src/js/currency.js @@ -67,7 +67,7 @@ Currency.prototype.is_native = function () { }; Currency.prototype.is_valid = function () { - return !isNaN(this._value); + return 'string' === typeof this._value || !isNaN(this._value); }; Currency.prototype.to_json = function () {