Use Sao.Decimal instead of Number to fix jshint error

This commit is contained in:
Cédric Krier committed 2013-01-07 15:02:34 +01:00
1 parent 82317d52a8
commit d30db00afc
4 files changed
+7 -5

No files matched your search

+2 -2
View File
@@ -486,7 +486,7 @@
Sao.field.Float = Sao.class_(Sao.field.Number, {
set_client: function(record, value) {
if (typeof value == 'string') {
value = Number(value); // without new for type conversion
value = Number(value);
if (isNaN(value)) {
value = this._default;
}
@@ -507,7 +507,7 @@
Sao.field.Numeric = Sao.class_(Sao.field.Number, {
set_client: function(record, value) {
if (typeof value == 'string') {
value = new Number(value); // with new to get an instance
value = new Sao.Decimal(value);
if (isNaN(value.valueOf())) {
value = this._default;
}
+2 -2
View File
@@ -81,7 +81,7 @@
case 'buffer':
throw new Error('Buffer support not implemented');
case 'Decimal':
value = new Number(value.decimal);
value = new Sao.Decimal(value.decimal);
break;
}
if (parent) {
@@ -125,7 +125,7 @@
if (parent) {
parent[index] = value;
}
} else if (value instanceof Number) {
} else if (value instanceof Sao.Decimal) {
value = {
'__class__': 'Decimal',
'decimal': value.valueOf()
+2
View File
@@ -32,4 +32,6 @@ var Sao = {};
}
return ClassConstructor;
};
Sao.Decimal = Number;
}());
+1 -1
View File
@@ -25,7 +25,7 @@
},
'datetime': new Date(2012, 11, 29, 19, 59, 10),
'date': new Date(2012, 11, 29),
'decimal': new Number(1.1)
'decimal': new Sao.Decimal(1.1)
};
for (var name in tests) {
var test = tests[name];