10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-05 05:33:55 +01:00
QUESTDB_website/static/js/floatUtils.js

25 lines
410 B
JavaScript
Raw Normal View History

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 {
2020-02-01 17:19:40 +01:00
return !isNaN(parseFloat(string))
} catch (error) {
return false
}
}