10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 21:24:00 +01:00

Add optional printNaN to stringFloat

This commit is contained in:
Mickaël Véril 2020-02-01 17:32:06 +01:00
parent 02dfbe9a9e
commit 8d47040564

View File

@ -1,6 +1,7 @@
class stringFloat{ class stringFloat{
constructor(value) { constructor(value,printNaN=true) {
this.string=value this.string=value
this.printNaN=printNaN
} }
get Value(){ get Value(){
return parseFloat(this.string) return parseFloat(this.string)
@ -9,10 +10,10 @@ class stringFloat{
return this.Value; return this.Value;
} }
toString(){ toString(){
if (checkFloat(this.string)) { if (checkFloat(this.string) && this.printNaN) {
return this.Value
} else {
return this.string return this.string
} else {
return NaN.toString()
} }
} }
} }