@hpcc-js/dataflow 9.5.1 → 9.6.1
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/README.md +23 -23
- package/dist/index.js +1 -560
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +8 -5
- package/src/activities/histogram.ts +23 -2
- package/src/utils/pipe.ts +222 -63
- package/types/activities/histogram.d.ts +5 -0
- package/types/utils/pipe.d.ts +133 -40
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ const concatDEF = concat(["d", "e", "f"]);
|
|
|
116
116
|
concatDEF(["a", "b", "c"]); // => "a", "b", "c", "d", "e", "f"
|
|
117
117
|
concatDEF(["1", "2", "3"]); // => "1", "2", "3", "d", "e", "f"
|
|
118
118
|
```
|
|
119
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/concat.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
119
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/concat.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/concat.spec.ts)
|
|
120
120
|
|
|
121
121
|
<a name="each" href="#each">#</a> **each**(_iterable_, _callbackFn_): _iterable_ <br>
|
|
122
122
|
<a name="each" href="#each">#</a> **each**(_callbackFn): (_iterable_) => _iterable_ <br>
|
|
@@ -130,7 +130,7 @@ const logFlow = each(console.log);
|
|
|
130
130
|
logFlow(["a", "b", "c"]); // => "a", "b", "c"
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/each.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
133
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/each.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/each.spec.ts)
|
|
134
134
|
|
|
135
135
|
<a name="entries" href="#entries">#</a> **entries**(_iterable_): _iterable_ <br>
|
|
136
136
|
<a name="entries" href="#entries">#</a> **entries**(): (_iterable_) => _iterable_ <br>
|
|
@@ -143,7 +143,7 @@ entries(["a", "b", "c"]); // => [0, "a"], [1, "b"], [2, "c"]
|
|
|
143
143
|
const calcEntries = entries();
|
|
144
144
|
calcEntries(["a", "b", "c"]); // => [0, "a"], [1, "b"], [2, "c"]
|
|
145
145
|
```
|
|
146
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/entries.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
146
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/entries.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/entries.spec.ts)
|
|
147
147
|
|
|
148
148
|
<a name="filter" href="#filter">#</a> **filter**(_iterable_, _condition_): _iterable_ <br>
|
|
149
149
|
<a name="filter" href="#filter">#</a> **filter**(_condition_): (_iterable_) => _iterable_ <br>
|
|
@@ -159,7 +159,7 @@ const smallWords = filter(word => word.length <= 6);
|
|
|
159
159
|
smallWords(words); // => "spray", "limit", "elite"
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/filter.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
162
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/filter.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/filter.spec.ts)
|
|
163
163
|
|
|
164
164
|
<a name="first" href="#first">#</a> **first**(_iterable_, _number_): _iterable_ <br>
|
|
165
165
|
<a name="first" href="#first">#</a> **first**(_number_): (_iterable_) => _iterable_ <br>
|
|
@@ -175,7 +175,7 @@ const first2 = first(2);
|
|
|
175
175
|
first2(words); // => "spray", "limit"
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/first.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
178
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/first.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/first.spec.ts)
|
|
179
179
|
|
|
180
180
|
<a name="group" href="#group">#</a> **group**(_iterable_, _condition_): _iterable_ <br>
|
|
181
181
|
<a name="group" href="#group">#</a> **group**(_condition_): (_iterable_) => _iterable_ <br>
|
|
@@ -191,7 +191,7 @@ const groupByLength = group(word => word.length);
|
|
|
191
191
|
groupByLength(words); // => {key: 3, value: ["one", "two", "six"]}, {key: 4, value: ["four", "five"]}, { key: 5, value: ["three"]}
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/group.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
194
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/group.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/group.spec.ts)
|
|
195
195
|
|
|
196
196
|
<a name="histogram" href="#histogram">#</a> **histogram**(_iterable_, _condition_, _options_): _iterable_ <br>
|
|
197
197
|
<a name="histogram" href="#histogram">#</a> **histogram**(_condition_, _options_): (_iterable_) => _iterable_ <br>
|
|
@@ -214,7 +214,7 @@ histogram(data, n => n, { buckets: 3 }); // => {"from":1,"to":7,"value":[1,3,6]
|
|
|
214
214
|
histogram(data, n => n, { min: 0, range: 5 }); // => {"from":0,"to":5,"value":[1,3]},{"from":5,"to":10,"value":[6]},{"from":10,"to":15,"value":[12,13,13,14]},{"from":15,"to":20,"value":[19]}
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/histogram.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
217
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/histogram.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/histogram.spec.ts)
|
|
218
218
|
|
|
219
219
|
<a name="map" href="#map">#</a> **map**(_iterable_, _callback_): _iterable_ <br>
|
|
220
220
|
<a name="map" href="#map">#</a> **map**(_callback_): (_iterable_) => _iterable_ <br>
|
|
@@ -228,7 +228,7 @@ const indexData = map((row, idx) => ({ ...row, index: idx + 1 }));
|
|
|
228
228
|
indexData([{ n: 22 }, { n: 11 }, { n: 33 }]); // => { n: 22, index: 1 }, { n: 11, index: 2 }, { n: 33, index: 3 }
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/map.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
231
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/map.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/map.spec.ts)
|
|
232
232
|
|
|
233
233
|
<a name="skip" href="#skip">#</a> **skip**(_iterable_, _number_): _iterable_ <br>
|
|
234
234
|
<a name="skip" href="#skip">#</a> **skip**(_number_): (_iterable_) => _iterable_ <br>
|
|
@@ -244,7 +244,7 @@ const skip4 = skip(4);
|
|
|
244
244
|
skip4(words); // => "destruction", "present"
|
|
245
245
|
```
|
|
246
246
|
|
|
247
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/skip.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
247
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/skip.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/skip.spec.ts)
|
|
248
248
|
|
|
249
249
|
<a name="sort" href="#sort">#</a> **sort**(_iterable_, _compare_): _iterable_ <br>
|
|
250
250
|
<a name="sort" href="#sort">#</a> **sort**(_compare_): (_iterable_) => _iterable_ <br>
|
|
@@ -261,7 +261,7 @@ const reverseSort = sort((a, b) => b - a);
|
|
|
261
261
|
reverseSort(numbers) // => 5, 4, 3, 2, 1
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/sort.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
264
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/activities/sort.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/sort.spec.ts)
|
|
265
265
|
|
|
266
266
|
### Sensors
|
|
267
267
|
|
|
@@ -307,7 +307,7 @@ s2.peek(); // => 699;
|
|
|
307
307
|
const doCount = scalar(count());
|
|
308
308
|
doCount([5, 1, 2, -3, 4]); // => 5
|
|
309
309
|
```
|
|
310
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/count.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
310
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/count.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/count.spec.ts)
|
|
311
311
|
|
|
312
312
|
<a name="min" href="#min">#</a> **min**(): _Observer_ <br>
|
|
313
313
|
<a name="min" href="#min">#</a> **min**(_accessor_): _Observer_ <br>
|
|
@@ -329,7 +329,7 @@ s2.peek() // => 4
|
|
|
329
329
|
const calcMin = scalar(min(row => row.id));
|
|
330
330
|
calcMin([{ id: 22 }, { id: 44 }, { id: 33 }]); // => 22
|
|
331
331
|
```
|
|
332
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/min.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
332
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/min.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/min.spec.ts)
|
|
333
333
|
|
|
334
334
|
<a name="max" href="#max">#</a> **max**(): _Observer_ <br>
|
|
335
335
|
<a name="max" href="#max">#</a> **max**(_accessor_): _Observer_ <br>
|
|
@@ -352,7 +352,7 @@ const calcMax = scalar(max(row => row.id));
|
|
|
352
352
|
calcMax([{ id: 22 }, { id: 44 }, { id: 33 }]); // => 44
|
|
353
353
|
```
|
|
354
354
|
|
|
355
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/max.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
355
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/max.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/max.spec.ts)
|
|
356
356
|
|
|
357
357
|
<a name="extent" href="#extent">#</a> **extent**(): _Observer_ <br>
|
|
358
358
|
<a name="extent" href="#extent">#</a> **extent**(_accessor_): _Observer_ <br>
|
|
@@ -375,7 +375,7 @@ const calcExtent = scalar(extent(row => row.id));
|
|
|
375
375
|
calcExtent([{ id: 22 }, { id: 44 }, { id: 33 }]); // => [22, 44]
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/extent.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
378
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/extent.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/extent.spec.ts)
|
|
379
379
|
|
|
380
380
|
<a name="mean" href="#mean">#</a> **mean**(): _Observer_ <br>
|
|
381
381
|
<a name="mean" href="#mean">#</a> **mean**(_accessor_): _Observer_ <br>
|
|
@@ -387,7 +387,7 @@ const calcMean = scalar(mean());
|
|
|
387
387
|
calcMean([5, -6, 1, 2, -2])) // => 0
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/mean.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
390
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/mean.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/mean.spec.ts)
|
|
391
391
|
|
|
392
392
|
<a name="median" href="#median">#</a> **median**(): _Observer_ <br>
|
|
393
393
|
<a name="median" href="#median">#</a> **median**(_accessor_): _Observer_ <br>
|
|
@@ -403,7 +403,7 @@ calcMedian([5, -6, 1, 2, -2, 6]) // => 1.5
|
|
|
403
403
|
calcMedian([9]) // => 9
|
|
404
404
|
```
|
|
405
405
|
|
|
406
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/median.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
406
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/median.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/median.spec.ts)
|
|
407
407
|
|
|
408
408
|
<a name="quartile" href="#quartile">#</a> **quartile**(): _Observer_ <br>
|
|
409
409
|
<a name="quartile" href="#quartile">#</a> **quartile**(_accessor_): _Observer_ <br>
|
|
@@ -418,7 +418,7 @@ calcQuartile([1, 22, 133]) // => [1, 1, 22, 133
|
|
|
418
418
|
calcQuartile([2, 144, 33]) // => [2, 2, 33, 144, 144]
|
|
419
419
|
```
|
|
420
420
|
|
|
421
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/quartile.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
421
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/quartile.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/quartile.spec.ts)
|
|
422
422
|
|
|
423
423
|
<a name="reduce" href="#reduce">#</a> **reduce**(_reducer_[, _initialValue_]): _Observer_ <br>
|
|
424
424
|
|
|
@@ -433,7 +433,7 @@ calcReduce1([1, 2, 3, 4, 5]) // => 15
|
|
|
433
433
|
calcReduce2([1, 2, 3, 4, 5]) // => 25
|
|
434
434
|
```
|
|
435
435
|
|
|
436
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/reduce.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
436
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/reduce.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/reduce.spec.ts)
|
|
437
437
|
|
|
438
438
|
<a name="variance" href="#variance">#</a> **variance**(): _Observer_ <br>
|
|
439
439
|
<a name="variance" href="#variance">#</a> **variance**(_accessor_): _Observer_ <br>
|
|
@@ -445,7 +445,7 @@ const calcVariance = scalar(variance());
|
|
|
445
445
|
calcVariance([5, 1, 2, 3, 4]) // => 2.5
|
|
446
446
|
```
|
|
447
447
|
|
|
448
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/variance.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
448
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/variance.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/variance.spec.ts)
|
|
449
449
|
|
|
450
450
|
<a name="deviation" href="#deviation">#</a> **deviation**(): _Observer_ <br>
|
|
451
451
|
<a name="deviation" href="#deviation">#</a> **deviation**(_accessor_): _Observer_ <br>
|
|
@@ -457,7 +457,7 @@ const calcDeviation = scalar(deviation());
|
|
|
457
457
|
calcDeviation([5, 1, 2, 3, 4]) // => 1.58113883008 == sqrt(2.5)
|
|
458
458
|
```
|
|
459
459
|
|
|
460
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/deviation.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
460
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/deviation.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/deviation.spec.ts)
|
|
461
461
|
|
|
462
462
|
<a name="distribution" href="#distribution">#</a> **distribution**(): _Observer_<_number_, { min: _number_, mean: _number_, max: _number_, deviation: _number_, variance: _number_}> <br>
|
|
463
463
|
<a name="distribution" href="#distribution">#</a> **distribution**(_accessor_): _Observer_<_any_, { min: _number_, mean: _number_, max: _number_, deviation: _number_, variance: _number_}> <br>
|
|
@@ -469,7 +469,7 @@ const calcDistribution = scalar(distribution());
|
|
|
469
469
|
calcDistribution([5, 1, 2, 3, 4])) // => { min: 1, mean: 3, max: 5, deviation: Math.sqrt(2.5), variance: 2.5}
|
|
470
470
|
```
|
|
471
471
|
|
|
472
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/distribution.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
472
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/observers/distribution.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/distribution.spec.ts)
|
|
473
473
|
|
|
474
474
|
### Convenience
|
|
475
475
|
|
|
@@ -514,7 +514,7 @@ const process_2 = pipe(
|
|
|
514
514
|
process_2([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); // => 0
|
|
515
515
|
```
|
|
516
516
|
|
|
517
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/utils/pipe.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
517
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/utils/pipe.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/pipe.spec.ts)
|
|
518
518
|
|
|
519
519
|
<a name="generate" href="#generate">#</a> **generate**(_generatorFn_[, _maxIterations_]): _iterable_ <br>
|
|
520
520
|
|
|
@@ -527,4 +527,4 @@ generate(Math.random, 100); // => Random number iterator limited to 100 items
|
|
|
527
527
|
|
|
528
528
|
```
|
|
529
529
|
|
|
530
|
-
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/utils/generate.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/
|
|
530
|
+
[[source]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/src/utils/generate.ts) [[tests]](https://github.com/hpcc-systems/Visualization/blob/trunk/packages/dataflow/tests/generate.spec.ts)
|