#2810 JS: Decimal.toStr()

SlimerDude Mon 27 Jul 2020

Decimal.js does not currently have a toStr() method.

I propose that this simple little addition, while it may not have perfectly consistent formatting, is better than NOT having any toStr method.

diff --git a/src/sys/js/fan/Decimal.js b/src/sys/js/fan/Decimal.js
index 8831902..25d3f78 100644
--- a/src/sys/js/fan/Decimal.js
+++ b/src/sys/js/fan/Decimal.js
@@ -101,4 +101,9 @@ fan.sys.Decimal.toLocale = function(self, pattern, locale)
   //
   // // route to common FanNum method
   // return FanNum.toLocale(p, d, df);
-}
\ No newline at end of file
+}
+
+fan.sys.Decimal.toStr = function(self)
+{
+  return fan.sys.Float.toStr(self);
+}

matthew Mon 27 Jul 2020

Ticket promoted to #2810 and assigned to matthew

matthew Mon 27 Jul 2020

Ticket resolved in 1.0.75

Used the implementation @SlimerDude provided as the default implementation.

Login or Signup to reply.