mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-08-26 22:21:53 +02:00
25 lines
409 B
JavaScript
25 lines
409 B
JavaScript
class stringFloat{
|
|
constructor(value) {
|
|
this.string=value
|
|
}
|
|
get Value(){
|
|
return parseFloat(this.string)
|
|
}
|
|
valueOf() {
|
|
return this.Value;
|
|
}
|
|
toString(){
|
|
if (isNaN(checkFloat(this.Value))) {
|
|
return this.Value
|
|
} else {
|
|
return this.string
|
|
}
|
|
}
|
|
}
|
|
function checkFloat(string) {
|
|
try {
|
|
return isNaN(parseFloat(string))
|
|
} catch (error) {
|
|
return false
|
|
}
|
|
} |