From 74509f97ee148b1eb9f546fc42799090cce3e5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 1 Feb 2020 16:58:43 +0100 Subject: [PATCH] Add stringFLoat class in js that help to keep significant figure --- static/js/stringFloat.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 static/js/stringFloat.js diff --git a/static/js/stringFloat.js b/static/js/stringFloat.js new file mode 100644 index 00000000..edbbe4da --- /dev/null +++ b/static/js/stringFloat.js @@ -0,0 +1,18 @@ +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 + } + } +} \ No newline at end of file