fable 3.0.112 → 3.0.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fable",
3
- "version": "3.0.112",
3
+ "version": "3.0.113",
4
4
  "description": "An entity behavior management and API bundling library.",
5
5
  "main": "source/Fable.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@ class DataFormat extends libFableServiceProviderBase
8
8
  {
9
9
  constructor(pFable, pOptions, pServiceHash)
10
10
  {
11
- super(pFable, pOptions, pServiceHash)
11
+ super(pFable, pOptions, pServiceHash);
12
12
 
13
13
  this.serviceType = 'DataArithmatic';
14
14
 
@@ -60,7 +60,7 @@ class DataFormat extends libFableServiceProviderBase
60
60
  * @param {*} pString
61
61
  * @param {*} pSearchString
62
62
  * @param {*} pStartIndex
63
- * @returns {*}
63
+ * @returns {boolean}
64
64
  */
65
65
  stringStartsWith (pString, pSearchString, pStartIndex)
66
66
  {
@@ -15,6 +15,22 @@ class FableServiceMath extends libFableServiceBase
15
15
  this.serviceType = 'Math';
16
16
  }
17
17
 
18
+ parsePrecise(pValue)
19
+ {
20
+ let tmpNumber = "0.0";
21
+
22
+ try
23
+ {
24
+ tmpNumber = new this.fable.Utility.bigNumber(pValue);
25
+ }
26
+ catch(pError)
27
+ {
28
+ console.log(`Error parsing number (type ${typeof(pValue)}): ${pError}`);
29
+ }
30
+
31
+ return tmpNumber.toString();
32
+ }
33
+
18
34
  addPrecise(pLeftValue, pRightValue)
19
35
  {
20
36
  let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
@@ -11,6 +11,7 @@ class FableOperation extends libFableServiceBase
11
11
 
12
12
  // Timestamps will just be the long ints
13
13
  this.timeStamps = {};
14
+
14
15
  // ProgressTrackers have an object format of: {Hash:'SomeHash',EndTime:UINT,CurrentTime:UINT,TotalCount:INT,CurrentCount:INT}
15
16
  this.progressTrackers = {};
16
17
 
package/test/Math_test.js CHANGED
@@ -39,6 +39,21 @@ suite
39
39
  Expect(testFable.Math.dividePrecise(1, 1)).to.equal('1');
40
40
  Expect(testFable.Math.percentagePrecise(1, 1)).to.equal('100');
41
41
 
42
+ return fDone();
43
+ }
44
+ );
45
+ test
46
+ (
47
+ 'Parse Numbers',
48
+ function(fDone)
49
+ {
50
+ let testFable = new libFable();
51
+
52
+ Expect(testFable.Math.parsePrecise(1)).to.equal('1');
53
+ // 3.3333333333333333333333333333333 in the current node.js implementation collapses to 3.3333333333333335
54
+ Expect(testFable.Math.parsePrecise('4.3333333333333333333333333333333')).to.equal('4.3333333333333333333333333333333');
55
+ Expect(testFable.Math.parsePrecise(undefined)).to.equal('0.0');
56
+
42
57
  return fDone();
43
58
  }
44
59
  );