fable 3.1.72 → 3.1.73
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/docs/README.md +30 -6
- package/docs/_brand.json +18 -0
- package/docs/_playground.json +10 -0
- package/docs/_sidebar.md +2 -0
- package/docs/_version.json +3 -3
- package/docs/architecture.md +201 -39
- package/docs/index.html +6 -7
- package/docs/pict-docuserve.min.js +91 -0
- package/docs/pict-docuserve.min.js.map +1 -0
- package/docs/playground.md +38 -0
- package/docs/retold-catalog.json +1 -1
- package/docs/retold-keyword-index.json +8721 -8105
- package/docs/services/README.md +26 -9
- package/docs/services/anticipate.md +104 -40
- package/docs/services/csv-parser.md +63 -35
- package/docs/services/data-format.md +154 -49
- package/docs/services/data-generation.md +77 -16
- package/docs/services/dates.md +103 -36
- package/docs/services/environment-data.md +13 -2
- package/docs/services/expression-parser.md +280 -68
- package/docs/services/file-persistence.md +142 -150
- package/docs/services/logging.md +93 -37
- package/docs/services/logic.md +70 -22
- package/docs/services/manifest.md +114 -26
- package/docs/services/math.md +168 -63
- package/docs/services/meta-template.md +312 -158
- package/docs/services/object-cache.md +94 -11
- package/docs/services/operation.md +68 -6
- package/docs/services/progress-time.md +74 -13
- package/docs/services/progress-tracker-set.md +101 -3
- package/docs/services/rest-client.md +136 -104
- package/docs/services/settings-manager.md +133 -40
- package/docs/services/template.md +71 -22
- package/docs/services/utility.md +121 -29
- package/docs/services/uuid.md +58 -10
- package/package.json +2 -2
- package/.claude/settings.local.json +0 -8
package/docs/services/math.md
CHANGED
|
@@ -5,24 +5,33 @@ The Math service provides arbitrary precision mathematical operations using `big
|
|
|
5
5
|
## Access
|
|
6
6
|
|
|
7
7
|
```javascript
|
|
8
|
+
const libFable = require('fable');
|
|
9
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
10
|
+
|
|
8
11
|
// Auto-instantiated, available directly
|
|
9
|
-
fable.Math
|
|
12
|
+
console.log('fable.Math:', typeof fable.Math);
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
## Constants
|
|
13
16
|
|
|
14
17
|
```javascript
|
|
15
|
-
|
|
16
|
-
fable
|
|
18
|
+
const libFable = require('fable');
|
|
19
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
20
|
+
|
|
21
|
+
console.log('pi:', fable.Math.pi); // Pi to 100 decimal places
|
|
22
|
+
console.log('euler:', fable.Math.euler); // Euler's number to 100 decimal places
|
|
17
23
|
```
|
|
18
24
|
|
|
19
25
|
## Rounding Methods
|
|
20
26
|
|
|
21
27
|
```javascript
|
|
22
|
-
|
|
23
|
-
fable
|
|
24
|
-
|
|
25
|
-
fable.Math.
|
|
28
|
+
const libFable = require('fable');
|
|
29
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
30
|
+
|
|
31
|
+
console.log('roundDown:', fable.Math.roundDown); // 0 - Truncate toward zero
|
|
32
|
+
console.log('roundHalfUp:', fable.Math.roundHalfUp); // 1 - Round to nearest, ties away from zero
|
|
33
|
+
console.log('roundHalfEven:', fable.Math.roundHalfEven); // 2 - Round to nearest, ties to even
|
|
34
|
+
console.log('roundUp:', fable.Math.roundUp); // 3 - Always round away from zero
|
|
26
35
|
```
|
|
27
36
|
|
|
28
37
|
## Basic Operations
|
|
@@ -30,57 +39,84 @@ fable.Math.roundUp // 3 - Always round away from zero
|
|
|
30
39
|
### Addition
|
|
31
40
|
|
|
32
41
|
```javascript
|
|
33
|
-
|
|
34
|
-
fable
|
|
42
|
+
const libFable = require('fable');
|
|
43
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
44
|
+
|
|
45
|
+
console.log(fable.Math.addPrecise('1.5', '2.5')); // Returns '4'
|
|
46
|
+
console.log(fable.Math.addPrecise(1.5, 2.5)); // Also works with numbers
|
|
35
47
|
```
|
|
36
48
|
|
|
37
49
|
### Subtraction
|
|
38
50
|
|
|
39
51
|
```javascript
|
|
40
|
-
|
|
52
|
+
const libFable = require('fable');
|
|
53
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
54
|
+
|
|
55
|
+
console.log(fable.Math.subtractPrecise('10', '3.5')); // Returns '6.5'
|
|
41
56
|
```
|
|
42
57
|
|
|
43
58
|
### Multiplication
|
|
44
59
|
|
|
45
60
|
```javascript
|
|
46
|
-
|
|
61
|
+
const libFable = require('fable');
|
|
62
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
63
|
+
|
|
64
|
+
console.log(fable.Math.multiplyPrecise('2.5', '4')); // Returns '10'
|
|
47
65
|
```
|
|
48
66
|
|
|
49
67
|
### Division
|
|
50
68
|
|
|
51
69
|
```javascript
|
|
52
|
-
|
|
70
|
+
const libFable = require('fable');
|
|
71
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
72
|
+
|
|
73
|
+
console.log(fable.Math.dividePrecise('10', '3')); // Returns '3.33333...'
|
|
53
74
|
```
|
|
54
75
|
|
|
55
76
|
### Power
|
|
56
77
|
|
|
57
78
|
```javascript
|
|
58
|
-
|
|
79
|
+
const libFable = require('fable');
|
|
80
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
81
|
+
|
|
82
|
+
console.log(fable.Math.powerPrecise('2', '10')); // Returns '1024'
|
|
59
83
|
```
|
|
60
84
|
|
|
61
85
|
### Modulo
|
|
62
86
|
|
|
63
87
|
```javascript
|
|
64
|
-
|
|
88
|
+
const libFable = require('fable');
|
|
89
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
90
|
+
|
|
91
|
+
console.log(fable.Math.modPrecise('10', '3')); // Returns '1'
|
|
65
92
|
```
|
|
66
93
|
|
|
67
94
|
### Square Root
|
|
68
95
|
|
|
69
96
|
```javascript
|
|
70
|
-
|
|
97
|
+
const libFable = require('fable');
|
|
98
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
99
|
+
|
|
100
|
+
console.log(fable.Math.sqrtPrecise('16')); // Returns '4'
|
|
71
101
|
```
|
|
72
102
|
|
|
73
103
|
### Absolute Value
|
|
74
104
|
|
|
75
105
|
```javascript
|
|
76
|
-
|
|
106
|
+
const libFable = require('fable');
|
|
107
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
108
|
+
|
|
109
|
+
console.log(fable.Math.absPrecise('-5.5')); // Returns '5.5'
|
|
77
110
|
```
|
|
78
111
|
|
|
79
112
|
### Floor and Ceiling
|
|
80
113
|
|
|
81
114
|
```javascript
|
|
82
|
-
|
|
83
|
-
fable
|
|
115
|
+
const libFable = require('fable');
|
|
116
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
117
|
+
|
|
118
|
+
console.log(fable.Math.floorPrecise('3.7')); // Returns '3'
|
|
119
|
+
console.log(fable.Math.ceilPrecise('3.2')); // Returns '4'
|
|
84
120
|
```
|
|
85
121
|
|
|
86
122
|
## Rounding and Formatting
|
|
@@ -88,14 +124,20 @@ fable.Math.ceilPrecise('3.2'); // Returns '4'
|
|
|
88
124
|
### Round to Decimal Places
|
|
89
125
|
|
|
90
126
|
```javascript
|
|
91
|
-
|
|
92
|
-
fable
|
|
127
|
+
const libFable = require('fable');
|
|
128
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
129
|
+
|
|
130
|
+
console.log(fable.Math.roundPrecise('3.14159', 2)); // Returns '3.14'
|
|
131
|
+
console.log(fable.Math.roundPrecise('3.14159', 2, fable.Math.roundUp)); // Returns '3.15'
|
|
93
132
|
```
|
|
94
133
|
|
|
95
134
|
### Fixed Decimal Places
|
|
96
135
|
|
|
97
136
|
```javascript
|
|
98
|
-
|
|
137
|
+
const libFable = require('fable');
|
|
138
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
139
|
+
|
|
140
|
+
console.log(fable.Math.toFixedPrecise('3.1', 4)); // Returns '3.1000'
|
|
99
141
|
```
|
|
100
142
|
|
|
101
143
|
## Comparison Operations
|
|
@@ -103,56 +145,77 @@ fable.Math.toFixedPrecise('3.1', 4); // Returns '3.1000'
|
|
|
103
145
|
### Compare Values
|
|
104
146
|
|
|
105
147
|
```javascript
|
|
106
|
-
|
|
107
|
-
fable
|
|
108
|
-
|
|
148
|
+
const libFable = require('fable');
|
|
149
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
150
|
+
|
|
151
|
+
console.log(fable.Math.comparePrecise('5', '3')); // Returns 1 (left > right)
|
|
152
|
+
console.log(fable.Math.comparePrecise('3', '5')); // Returns -1 (left < right)
|
|
153
|
+
console.log(fable.Math.comparePrecise('5', '5')); // Returns 0 (equal)
|
|
109
154
|
```
|
|
110
155
|
|
|
111
156
|
### Compare Within Tolerance
|
|
112
157
|
|
|
113
158
|
```javascript
|
|
114
|
-
|
|
159
|
+
const libFable = require('fable');
|
|
160
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
161
|
+
|
|
162
|
+
console.log(fable.Math.comparePreciseWithin('1.0001', '1.0002', '0.001')); // Returns 0 (within tolerance)
|
|
115
163
|
```
|
|
116
164
|
|
|
117
165
|
### Boolean Comparisons
|
|
118
166
|
|
|
119
167
|
```javascript
|
|
120
|
-
|
|
121
|
-
fable
|
|
122
|
-
|
|
123
|
-
fable.Math.
|
|
168
|
+
const libFable = require('fable');
|
|
169
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
170
|
+
|
|
171
|
+
console.log(fable.Math.gtPrecise('5', '3')); // Returns true
|
|
172
|
+
console.log(fable.Math.gtePrecise('5', '5')); // Returns true
|
|
173
|
+
console.log(fable.Math.ltPrecise('3', '5')); // Returns true
|
|
174
|
+
console.log(fable.Math.ltePrecise('5', '5')); // Returns true
|
|
124
175
|
```
|
|
125
176
|
|
|
126
177
|
## Parsing
|
|
127
178
|
|
|
128
179
|
```javascript
|
|
129
|
-
|
|
130
|
-
fable
|
|
131
|
-
|
|
180
|
+
const libFable = require('fable');
|
|
181
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
182
|
+
|
|
183
|
+
console.log(fable.Math.parsePrecise('123.456')); // Returns '123.456'
|
|
184
|
+
console.log(fable.Math.parsePrecise('invalid', '0')); // Returns '0' (default value)
|
|
185
|
+
console.log(fable.Math.parsePrecise('not a number', null)); // Returns null
|
|
132
186
|
```
|
|
133
187
|
|
|
134
188
|
## Percentage
|
|
135
189
|
|
|
136
190
|
```javascript
|
|
137
|
-
|
|
138
|
-
fable
|
|
191
|
+
const libFable = require('fable');
|
|
192
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
193
|
+
|
|
194
|
+
console.log(fable.Math.percentagePrecise('25', '100')); // Returns '25' (25 is 25% of 100)
|
|
195
|
+
console.log(fable.Math.percentagePrecise('1', '4')); // Returns '25' (1 is 25% of 4)
|
|
139
196
|
```
|
|
140
197
|
|
|
141
198
|
## Trigonometry
|
|
142
199
|
|
|
143
200
|
```javascript
|
|
144
|
-
|
|
145
|
-
fable.
|
|
146
|
-
|
|
147
|
-
fable.Math.
|
|
201
|
+
const libFable = require('fable');
|
|
202
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
203
|
+
|
|
204
|
+
console.log(fable.Math.sin(Math.PI / 2)); // Returns 1
|
|
205
|
+
console.log(fable.Math.cos(0)); // Returns 1
|
|
206
|
+
console.log(fable.Math.tan(0)); // Returns 0
|
|
207
|
+
console.log(fable.Math.radPrecise('180')); // Converts degrees to radians
|
|
148
208
|
```
|
|
149
209
|
|
|
150
210
|
## Logarithms and Exponentials
|
|
151
211
|
|
|
152
212
|
```javascript
|
|
153
|
-
|
|
154
|
-
fable
|
|
155
|
-
|
|
213
|
+
const libFable = require('fable');
|
|
214
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
215
|
+
|
|
216
|
+
console.log(fable.Math.logPrecise('100', 10)); // Returns log base 10 of 100
|
|
217
|
+
console.log(fable.Math.logPrecise('8', 2)); // Returns log base 2 of 8
|
|
218
|
+
console.log(fable.Math.expPrecise('2')); // Returns e^2
|
|
156
219
|
```
|
|
157
220
|
|
|
158
221
|
## Statistical Functions (Sets)
|
|
@@ -160,72 +223,99 @@ fable.Math.expPrecise('2'); // Returns e^2
|
|
|
160
223
|
### Count Elements
|
|
161
224
|
|
|
162
225
|
```javascript
|
|
163
|
-
|
|
164
|
-
fable
|
|
226
|
+
const libFable = require('fable');
|
|
227
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
228
|
+
|
|
229
|
+
console.log(fable.Math.countSetElements([1, 2, 3, 4, 5])); // Returns 5
|
|
230
|
+
console.log(fable.Math.countSetElements({a: 1, b: 2})); // Returns 2
|
|
165
231
|
```
|
|
166
232
|
|
|
167
233
|
### Sum
|
|
168
234
|
|
|
169
235
|
```javascript
|
|
170
|
-
|
|
236
|
+
const libFable = require('fable');
|
|
237
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
238
|
+
|
|
239
|
+
console.log(fable.Math.sumPrecise([1, 2, 3, 4, 5])); // Returns '15'
|
|
171
240
|
```
|
|
172
241
|
|
|
173
242
|
### Mean (Average)
|
|
174
243
|
|
|
175
244
|
```javascript
|
|
176
|
-
|
|
177
|
-
fable
|
|
245
|
+
const libFable = require('fable');
|
|
246
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
247
|
+
|
|
248
|
+
console.log(fable.Math.meanPrecise([1, 2, 3, 4, 5])); // Returns '3'
|
|
249
|
+
console.log(fable.Math.averagePrecise([1, 2, 3, 4, 5])); // Same as meanPrecise
|
|
178
250
|
```
|
|
179
251
|
|
|
180
252
|
### Median
|
|
181
253
|
|
|
182
254
|
```javascript
|
|
183
|
-
|
|
184
|
-
fable
|
|
255
|
+
const libFable = require('fable');
|
|
256
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
257
|
+
|
|
258
|
+
console.log(fable.Math.medianPrecise([1, 2, 3, 4, 5])); // Returns '3'
|
|
259
|
+
console.log(fable.Math.medianPrecise([1, 2, 3, 4])); // Returns '2.5'
|
|
185
260
|
```
|
|
186
261
|
|
|
187
262
|
### Mode
|
|
188
263
|
|
|
189
264
|
```javascript
|
|
190
|
-
|
|
265
|
+
const libFable = require('fable');
|
|
266
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
267
|
+
|
|
268
|
+
console.log(fable.Math.modePrecise([1, 2, 2, 3, 3, 3])); // Returns ['3']
|
|
191
269
|
```
|
|
192
270
|
|
|
193
271
|
### Min/Max
|
|
194
272
|
|
|
195
273
|
```javascript
|
|
196
|
-
|
|
197
|
-
fable
|
|
274
|
+
const libFable = require('fable');
|
|
275
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
276
|
+
|
|
277
|
+
console.log(fable.Math.minPrecise([5, 2, 8, 1, 9])); // Returns '1'
|
|
278
|
+
console.log(fable.Math.maxPrecise([5, 2, 8, 1, 9])); // Returns '9'
|
|
198
279
|
```
|
|
199
280
|
|
|
200
281
|
### Variance and Standard Deviation
|
|
201
282
|
|
|
202
283
|
```javascript
|
|
284
|
+
const libFable = require('fable');
|
|
285
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
286
|
+
|
|
203
287
|
// Sample variance (default)
|
|
204
|
-
fable.Math.variancePrecise([1, 2, 3, 4, 5]);
|
|
288
|
+
console.log(fable.Math.variancePrecise([1, 2, 3, 4, 5]));
|
|
205
289
|
|
|
206
290
|
// Population variance
|
|
207
|
-
fable.Math.populationVariancePrecise([1, 2, 3, 4, 5]);
|
|
291
|
+
console.log(fable.Math.populationVariancePrecise([1, 2, 3, 4, 5]));
|
|
208
292
|
|
|
209
293
|
// Sample standard deviation
|
|
210
|
-
fable.Math.standardDeviationPrecise([1, 2, 3, 4, 5]);
|
|
294
|
+
console.log(fable.Math.standardDeviationPrecise([1, 2, 3, 4, 5]));
|
|
211
295
|
|
|
212
296
|
// Population standard deviation
|
|
213
|
-
fable.Math.populationStandardDeviationPrecise([1, 2, 3, 4, 5]);
|
|
297
|
+
console.log(fable.Math.populationStandardDeviationPrecise([1, 2, 3, 4, 5]));
|
|
214
298
|
```
|
|
215
299
|
|
|
216
300
|
### Sorting
|
|
217
301
|
|
|
218
302
|
```javascript
|
|
219
|
-
|
|
303
|
+
const libFable = require('fable');
|
|
304
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
305
|
+
|
|
306
|
+
console.log(fable.Math.sortSetPrecise([3, 1, 4, 1, 5])); // Returns ['1', '1', '3', '4', '5']
|
|
220
307
|
```
|
|
221
308
|
|
|
222
309
|
### Histogram
|
|
223
310
|
|
|
224
311
|
```javascript
|
|
225
|
-
|
|
312
|
+
const libFable = require('fable');
|
|
313
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
314
|
+
|
|
315
|
+
console.log(fable.Math.histogramPrecise([1, 2, 2, 3, 3, 3]));
|
|
226
316
|
// Returns { '1': 1, '2': 2, '3': 3 }
|
|
227
317
|
|
|
228
|
-
fable.Math.bucketSetPrecise([1, 2, 3, 4, 5, 6], 2);
|
|
318
|
+
console.log(fable.Math.bucketSetPrecise([1, 2, 3, 4, 5, 6], 2));
|
|
229
319
|
// Bucketize by size 2
|
|
230
320
|
```
|
|
231
321
|
|
|
@@ -234,35 +324,48 @@ fable.Math.bucketSetPrecise([1, 2, 3, 4, 5, 6], 2);
|
|
|
234
324
|
### Matrix Operations
|
|
235
325
|
|
|
236
326
|
```javascript
|
|
327
|
+
const libFable = require('fable');
|
|
328
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
329
|
+
|
|
237
330
|
// Matrix transpose
|
|
238
|
-
fable.Math.matrixTranspose([[1, 2], [3, 4]]);
|
|
331
|
+
console.log(fable.Math.matrixTranspose([[1, 2], [3, 4]]));
|
|
239
332
|
|
|
240
333
|
// Matrix multiplication
|
|
241
|
-
fable.Math.matrixMultiply([[1, 2], [3, 4]], [[5, 6], [7, 8]]);
|
|
334
|
+
console.log(fable.Math.matrixMultiply([[1, 2], [3, 4]], [[5, 6], [7, 8]]));
|
|
242
335
|
|
|
243
336
|
// Matrix inverse
|
|
244
|
-
fable.Math.matrixInverse([[1, 2], [3, 4]]);
|
|
337
|
+
console.log(fable.Math.matrixInverse([[1, 2], [3, 4]]));
|
|
245
338
|
```
|
|
246
339
|
|
|
247
340
|
### Regression
|
|
248
341
|
|
|
249
342
|
```javascript
|
|
343
|
+
const libFable = require('fable');
|
|
344
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
345
|
+
|
|
250
346
|
// Least squares regression
|
|
251
347
|
const coefficients = fable.Math.leastSquares(
|
|
252
348
|
[1, 2, 3, 4, 5], // X values
|
|
253
349
|
[2, 4, 5, 4, 5] // Y values
|
|
254
350
|
);
|
|
351
|
+
console.log('coefficients:', coefficients);
|
|
255
352
|
|
|
256
353
|
// Predict from regression model
|
|
257
|
-
fable.Math.predictFromRegressionModel(coefficients, 6);
|
|
354
|
+
console.log('prediction at x=6:', fable.Math.predictFromRegressionModel(coefficients, 6));
|
|
258
355
|
|
|
259
356
|
// Polynomial regression
|
|
260
|
-
|
|
357
|
+
const xValues = [1, 2, 3, 4, 5];
|
|
358
|
+
const yValues = [1, 4, 9, 16, 25];
|
|
359
|
+
const degree = 2;
|
|
360
|
+
console.log('polynomial regression:', fable.Math.polynomialRegression(xValues, yValues, degree));
|
|
261
361
|
```
|
|
262
362
|
|
|
263
363
|
## Cumulative Operations
|
|
264
364
|
|
|
265
365
|
```javascript
|
|
366
|
+
const libFable = require('fable');
|
|
367
|
+
const fable = new libFable({ Product: 'MathDemo', ProductVersion: '1.0.0' });
|
|
368
|
+
|
|
266
369
|
const data = [
|
|
267
370
|
{ value: 10 },
|
|
268
371
|
{ value: 20 },
|
|
@@ -272,8 +375,10 @@ const data = [
|
|
|
272
375
|
// Cumulative summation
|
|
273
376
|
fable.Math.cumulativeSummation(data, 'value', 'cumulative');
|
|
274
377
|
// Adds 'cumulative' property: 10, 30, 60
|
|
378
|
+
console.log('After cumulativeSummation:', data);
|
|
275
379
|
|
|
276
380
|
// Subtracting summation (starting from a value)
|
|
277
381
|
fable.Math.subtractingSummation(data, 'value', 'remaining', '100');
|
|
278
382
|
// Subtracts from 100: 90, 70, 40
|
|
383
|
+
console.log('After subtractingSummation:', data);
|
|
279
384
|
```
|