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/dist/fable.compatible.js +89 -88
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +89 -88
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/services/Fable-Service-DataFormat.js +2 -2
- package/source/services/Fable-Service-Math.js +16 -0
- package/source/services/Fable-Service-Operation.js +1 -0
- package/test/Math_test.js +15 -0
package/package.json
CHANGED
|
@@ -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
|
);
|