JS: Add is_native() to Currency.

This commit is contained in:
Arthur Britto
2012-12-07 22:24:50 -08:00
parent e03ed39fca
commit dda0769c5e

View File

@@ -287,7 +287,7 @@ Currency.prototype.copyTo = function(d) {
Currency.prototype.equals = function(d) {
return ('string' !== typeof this._value && isNaN(this._value))
|| ('string' !== typeof d._value && isNaN(d._value)) ? false : this._value === d._value;
}
};
// this._value = NaN on error.
Currency.prototype.parse_json = function(j) {
@@ -304,6 +304,10 @@ Currency.prototype.parse_json = function(j) {
return this;
};
Currency.prototype.is_native = function () {
return !isNaN(this._value) && !this._value;
};
Currency.prototype.is_valid = function () {
return !isNaN(this._value);
};