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.
This commit is contained in:
Stefan Thomas
2013-03-11 14:17:57 +01:00
parent 104dcedf3a
commit ead47deab7

View File

@@ -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 () {