10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 11:17:42 +02: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{
constructor(value) {
constructor(value,printNaN=true) {
this.string=value
this.printNaN=printNaN
}
get Value(){
return parseFloat(this.string)
@ -9,10 +10,10 @@ class stringFloat{
return this.Value;
}
toString(){
if (checkFloat(this.string)) {
return this.Value
} else {
if (checkFloat(this.string) && this.printNaN) {
return this.string
} else {
return NaN.toString()
}
}
}