@hpcc-js/dataflow 9.4.2 → 9.5.0

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/index.js CHANGED
@@ -1,561 +1,500 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
+ //#region src/activities/activity.ts
3
2
  function isSource(source) {
4
- return source && (typeof source[Symbol.iterator] === "function" || Array.isArray(source));
3
+ return source && (typeof source[Symbol.iterator] === "function" || Array.isArray(source));
5
4
  }
6
- __name(isSource, "isSource");
5
+
6
+ //#endregion
7
+ //#region src/activities/concat.ts
7
8
  function concatGen(concatSource) {
8
- return function* (source) {
9
- yield* source;
10
- yield* concatSource;
11
- };
9
+ return function* (source) {
10
+ yield* source;
11
+ yield* concatSource;
12
+ };
12
13
  }
13
- __name(concatGen, "concatGen");
14
14
  function concat(s_or_n, concatSource) {
15
- return concatSource !== void 0 ? concatGen(concatSource)(s_or_n) : concatGen(s_or_n);
15
+ return concatSource !== void 0 ? concatGen(concatSource)(s_or_n) : concatGen(s_or_n);
16
16
  }
17
- __name(concat, "concat");
17
+
18
+ //#endregion
19
+ //#region src/activities/each.ts
18
20
  function eachGen(callbackFn) {
19
- return function* (source) {
20
- let i = -1;
21
- for (const item of source) {
22
- callbackFn(item, ++i);
23
- yield item;
24
- }
25
- };
26
- }
27
- __name(eachGen, "eachGen");
21
+ return function* (source) {
22
+ let i = -1;
23
+ for (const item of source) {
24
+ callbackFn(item, ++i);
25
+ yield item;
26
+ }
27
+ };
28
+ }
28
29
  function each(s_or_cb, callbackFn) {
29
- return isSource(s_or_cb) ? eachGen(callbackFn)(s_or_cb) : eachGen(s_or_cb);
30
+ return isSource(s_or_cb) ? eachGen(callbackFn)(s_or_cb) : eachGen(s_or_cb);
30
31
  }
31
- __name(each, "each");
32
+
33
+ //#endregion
34
+ //#region src/activities/entries.ts
32
35
  function entriesGen() {
33
- return function* (source) {
34
- let i = -1;
35
- for (const item of source) {
36
- yield [++i, item];
37
- }
38
- };
39
- }
40
- __name(entriesGen, "entriesGen");
36
+ return function* (source) {
37
+ let i = -1;
38
+ for (const item of source) yield [++i, item];
39
+ };
40
+ }
41
41
  function entries(source) {
42
- return source ? entriesGen()(source) : entriesGen();
42
+ return source ? entriesGen()(source) : entriesGen();
43
43
  }
44
- __name(entries, "entries");
44
+
45
+ //#endregion
46
+ //#region src/activities/filter.ts
45
47
  function filterGen(callbackFn) {
46
- return function* (source) {
47
- let i = -1;
48
- for (const item of source) {
49
- if (callbackFn(item, ++i)) {
50
- yield item;
51
- }
52
- }
53
- };
54
- }
55
- __name(filterGen, "filterGen");
48
+ return function* (source) {
49
+ let i = -1;
50
+ for (const item of source) if (callbackFn(item, ++i)) yield item;
51
+ };
52
+ }
56
53
  function filter(s_or_cb, callbackFn) {
57
- return isSource(s_or_cb) ? filterGen(callbackFn)(s_or_cb) : filterGen(s_or_cb);
54
+ return isSource(s_or_cb) ? filterGen(callbackFn)(s_or_cb) : filterGen(s_or_cb);
58
55
  }
59
- __name(filter, "filter");
56
+
57
+ //#endregion
58
+ //#region src/activities/first.ts
60
59
  function firstGen(n) {
61
- return function* (source) {
62
- let i = 0;
63
- for (const item of source) {
64
- yield item;
65
- if (++i >= n) {
66
- break;
67
- }
68
- }
69
- };
70
- }
71
- __name(firstGen, "firstGen");
60
+ return function* (source) {
61
+ let i = 0;
62
+ for (const item of source) {
63
+ yield item;
64
+ if (++i >= n) break;
65
+ }
66
+ };
67
+ }
72
68
  function first(s_or_n, n) {
73
- if (!isSource(s_or_n)) return firstGen(s_or_n);
74
- return firstGen(n)(s_or_n);
69
+ if (!isSource(s_or_n)) return firstGen(s_or_n);
70
+ return firstGen(n)(s_or_n);
75
71
  }
76
- __name(first, "first");
72
+
73
+ //#endregion
74
+ //#region src/activities/group.ts
77
75
  function groupGen(groupFn) {
78
- return function* (source) {
79
- let i = -1;
80
- const group2 = {};
81
- for (const row of source) {
82
- const key = groupFn(row, ++i);
83
- if (!group2[key]) {
84
- group2[key] = [];
85
- }
86
- group2[key].push(row);
87
- }
88
- for (const key in group2) {
89
- yield { key, value: group2[key] };
90
- }
91
- };
92
- }
93
- __name(groupGen, "groupGen");
76
+ return function* (source) {
77
+ let i = -1;
78
+ const group$1 = {};
79
+ for (const row of source) {
80
+ const key = groupFn(row, ++i);
81
+ if (!group$1[key]) group$1[key] = [];
82
+ group$1[key].push(row);
83
+ }
84
+ for (const key in group$1) yield {
85
+ key,
86
+ value: group$1[key]
87
+ };
88
+ };
89
+ }
94
90
  function group(s_or_gbf, groupByFn) {
95
- return isSource(s_or_gbf) ? groupGen(groupByFn)(s_or_gbf) : groupGen(s_or_gbf);
91
+ return isSource(s_or_gbf) ? groupGen(groupByFn)(s_or_gbf) : groupGen(s_or_gbf);
96
92
  }
97
- __name(group, "group");
93
+
94
+ //#endregion
95
+ //#region src/observers/observer.ts
98
96
  function Accessor(fof, accesor) {
99
- const s = fof();
100
- return {
101
- observe: /* @__PURE__ */ __name((_, i) => {
102
- s.observe(accesor(_, i), i);
103
- }, "observe"),
104
- peek: s.peek
105
- };
106
- }
107
- __name(Accessor, "Accessor");
97
+ const s = fof();
98
+ return {
99
+ observe: (_, i) => {
100
+ s.observe(accesor(_, i), i);
101
+ },
102
+ peek: s.peek
103
+ };
104
+ }
108
105
  function sensor(s) {
109
- return each((r, i) => s.observe(r, i));
106
+ return each((r, i) => s.observe(r, i));
110
107
  }
111
- __name(sensor, "sensor");
112
108
  function activity(s) {
113
- return function* (source) {
114
- let i = -1;
115
- for (const row of source) {
116
- s.observe(row, ++i);
117
- }
118
- yield s.peek();
119
- };
120
- }
121
- __name(activity, "activity");
109
+ return function* (source) {
110
+ let i = -1;
111
+ for (const row of source) s.observe(row, ++i);
112
+ yield s.peek();
113
+ };
114
+ }
122
115
  function scalar(s) {
123
- return function(source) {
124
- let i = -1;
125
- for (const row of source) {
126
- s.observe(row, ++i);
127
- }
128
- return s.peek();
129
- };
130
- }
131
- __name(scalar, "scalar");
116
+ return function(source) {
117
+ let i = -1;
118
+ for (const row of source) s.observe(row, ++i);
119
+ return s.peek();
120
+ };
121
+ }
122
+
123
+ //#endregion
124
+ //#region src/observers/max.ts
132
125
  function _max() {
133
- let max2;
134
- return {
135
- observe: /* @__PURE__ */ __name((value, idx) => {
136
- if (idx === 0) {
137
- max2 = value;
138
- } else if (max2 < value) {
139
- max2 = value;
140
- }
141
- }, "observe"),
142
- peek: /* @__PURE__ */ __name(() => max2, "peek")
143
- };
144
- }
145
- __name(_max, "_max");
126
+ let max$1;
127
+ return {
128
+ observe: (value, idx) => {
129
+ if (idx === 0) max$1 = value;
130
+ else if (max$1 < value) max$1 = value;
131
+ },
132
+ peek: () => max$1
133
+ };
134
+ }
146
135
  function max(callbackFn) {
147
- return callbackFn ? Accessor(_max, callbackFn) : _max();
136
+ return callbackFn ? Accessor(_max, callbackFn) : _max();
148
137
  }
149
- __name(max, "max");
138
+
139
+ //#endregion
140
+ //#region src/observers/min.ts
150
141
  function _min() {
151
- let min2;
152
- return {
153
- observe: /* @__PURE__ */ __name((value, idx) => {
154
- if (idx === 0) {
155
- min2 = value;
156
- } else if (min2 > value) {
157
- min2 = value;
158
- }
159
- }, "observe"),
160
- peek: /* @__PURE__ */ __name(() => min2, "peek")
161
- };
162
- }
163
- __name(_min, "_min");
142
+ let min$1;
143
+ return {
144
+ observe: (value, idx) => {
145
+ if (idx === 0) min$1 = value;
146
+ else if (min$1 > value) min$1 = value;
147
+ },
148
+ peek: () => min$1
149
+ };
150
+ }
164
151
  function min(callbackFn) {
165
- return callbackFn ? Accessor(_min, callbackFn) : _min();
152
+ return callbackFn ? Accessor(_min, callbackFn) : _min();
166
153
  }
167
- __name(min, "min");
154
+
155
+ //#endregion
156
+ //#region src/observers/extent.ts
168
157
  function _extent() {
169
- const minFO = min();
170
- const maxFO = max();
171
- return {
172
- observe: /* @__PURE__ */ __name((value, idx) => {
173
- minFO.observe(value, idx);
174
- maxFO.observe(value, idx);
175
- }, "observe"),
176
- peek: /* @__PURE__ */ __name(() => [minFO.peek(), maxFO.peek()], "peek")
177
- };
178
- }
179
- __name(_extent, "_extent");
158
+ const minFO = min();
159
+ const maxFO = max();
160
+ return {
161
+ observe: (value, idx) => {
162
+ minFO.observe(value, idx);
163
+ maxFO.observe(value, idx);
164
+ },
165
+ peek: () => [minFO.peek(), maxFO.peek()]
166
+ };
167
+ }
180
168
  function extent(callbackFn) {
181
- return callbackFn ? Accessor(_extent, callbackFn) : _extent();
169
+ return callbackFn ? Accessor(_extent, callbackFn) : _extent();
182
170
  }
183
- __name(extent, "extent");
171
+
172
+ //#endregion
173
+ //#region src/activities/histogram.ts
184
174
  function isOptionA(_) {
185
- return _.buckets !== void 0;
175
+ return _.buckets !== void 0;
186
176
  }
187
- __name(isOptionA, "isOptionA");
188
177
  function histogramGen(callbackFn, options) {
189
- return function* (_source) {
190
- let min2;
191
- let bucketSize;
192
- let source;
193
- if (isOptionA(options)) {
194
- source = Array.isArray(_source) ? _source : [..._source];
195
- const minMax = scalar(extent(callbackFn))(source);
196
- if (minMax === void 0) {
197
- return void 0;
198
- }
199
- min2 = minMax[0];
200
- const max2 = minMax[1];
201
- const buckets = options.buckets;
202
- bucketSize = (max2 - min2) / buckets;
203
- } else {
204
- source = _source;
205
- min2 = options.min;
206
- bucketSize = options.range;
207
- }
208
- const histogram2 = {};
209
- let maxBucketID = 0;
210
- for (const row of source) {
211
- const value = callbackFn(row);
212
- const bucketID = Math.floor((value - min2) / bucketSize);
213
- if (maxBucketID < bucketID) {
214
- maxBucketID = bucketID;
215
- }
216
- if (histogram2[bucketID] === void 0) {
217
- histogram2[bucketID] = [];
218
- }
219
- histogram2[bucketID].push(row);
220
- }
221
- const lastBucket = histogram2[maxBucketID];
222
- const from = min2 + maxBucketID * bucketSize;
223
- for (let i = 0; i <= maxBucketID; ++i) {
224
- if (i === maxBucketID - 1 && lastBucket.every((row) => from === callbackFn(row))) {
225
- yield {
226
- from: min2 + i * bucketSize,
227
- to: min2 + (i + 1) * bucketSize,
228
- value: [...histogram2[i] || [], ...lastBucket]
229
- };
230
- break;
231
- }
232
- yield {
233
- from: min2 + i * bucketSize,
234
- to: min2 + (i + 1) * bucketSize,
235
- value: histogram2[i] || []
236
- };
237
- }
238
- };
239
- }
240
- __name(histogramGen, "histogramGen");
178
+ return function* (_source) {
179
+ let min$1;
180
+ let bucketSize;
181
+ let source;
182
+ if (isOptionA(options)) {
183
+ source = Array.isArray(_source) ? _source : [..._source];
184
+ const minMax = scalar(extent(callbackFn))(source);
185
+ if (minMax === void 0) return;
186
+ min$1 = minMax[0];
187
+ const max$1 = minMax[1];
188
+ const buckets = options.buckets;
189
+ bucketSize = (max$1 - min$1) / buckets;
190
+ } else {
191
+ source = _source;
192
+ min$1 = options.min;
193
+ bucketSize = options.range;
194
+ }
195
+ const histogram$1 = {};
196
+ let maxBucketID = 0;
197
+ for (const row of source) {
198
+ const value = callbackFn(row);
199
+ const bucketID = Math.floor((value - min$1) / bucketSize);
200
+ if (maxBucketID < bucketID) maxBucketID = bucketID;
201
+ if (histogram$1[bucketID] === void 0) histogram$1[bucketID] = [];
202
+ histogram$1[bucketID].push(row);
203
+ }
204
+ const lastBucket = histogram$1[maxBucketID];
205
+ const from = min$1 + maxBucketID * bucketSize;
206
+ for (let i = 0; i <= maxBucketID; ++i) {
207
+ if (i === maxBucketID - 1 && lastBucket.every((row) => from === callbackFn(row))) {
208
+ yield {
209
+ from: min$1 + i * bucketSize,
210
+ to: min$1 + (i + 1) * bucketSize,
211
+ value: [...histogram$1[i] || [], ...lastBucket]
212
+ };
213
+ break;
214
+ }
215
+ yield {
216
+ from: min$1 + i * bucketSize,
217
+ to: min$1 + (i + 1) * bucketSize,
218
+ value: histogram$1[i] || []
219
+ };
220
+ }
221
+ };
222
+ }
241
223
  function histogram(s_or_hf, hf_or_b, options) {
242
- return isSource(s_or_hf) ? histogramGen(hf_or_b, options)(s_or_hf) : histogramGen(s_or_hf, hf_or_b);
224
+ return isSource(s_or_hf) ? histogramGen(hf_or_b, options)(s_or_hf) : histogramGen(s_or_hf, hf_or_b);
243
225
  }
244
- __name(histogram, "histogram");
226
+
227
+ //#endregion
228
+ //#region src/activities/join.ts
245
229
  function joinGen(_sourceU, callbackFn) {
246
- const sourceB = Array.isArray(_sourceU) ? _sourceU[Symbol.iterator]() : _sourceU;
247
- return function* (sourceT) {
248
- let i = -1;
249
- for (const item of sourceT) {
250
- yield callbackFn(item, sourceB.next().value, ++i);
251
- }
252
- };
253
- }
254
- __name(joinGen, "joinGen");
230
+ const sourceB = Array.isArray(_sourceU) ? _sourceU[Symbol.iterator]() : _sourceU;
231
+ return function* (sourceT) {
232
+ let i = -1;
233
+ for (const item of sourceT) yield callbackFn(item, sourceB.next().value, ++i);
234
+ };
235
+ }
255
236
  function join(sT_or_sU, sU_or_cb, callbackFn) {
256
- return isSource(sU_or_cb) ? joinGen(sU_or_cb, callbackFn)(sT_or_sU) : joinGen(sT_or_sU, sU_or_cb);
237
+ return isSource(sU_or_cb) ? joinGen(sU_or_cb, callbackFn)(sT_or_sU) : joinGen(sT_or_sU, sU_or_cb);
257
238
  }
258
- __name(join, "join");
239
+
240
+ //#endregion
241
+ //#region src/activities/map.ts
259
242
  function mapGen(callbackFn) {
260
- return function* (source) {
261
- let i = -1;
262
- for (const item of source) {
263
- yield callbackFn(item, ++i);
264
- }
265
- };
266
- }
267
- __name(mapGen, "mapGen");
243
+ return function* (source) {
244
+ let i = -1;
245
+ for (const item of source) yield callbackFn(item, ++i);
246
+ };
247
+ }
268
248
  function map(s_or_cb, callbackFn) {
269
- return isSource(s_or_cb) ? mapGen(callbackFn)(s_or_cb) : mapGen(s_or_cb);
249
+ return isSource(s_or_cb) ? mapGen(callbackFn)(s_or_cb) : mapGen(s_or_cb);
270
250
  }
271
- __name(map, "map");
251
+
252
+ //#endregion
253
+ //#region src/activities/normalize.ts
272
254
  function normalizeGen() {
273
- const calcExtent = scalar(extent());
274
- return function* (_source) {
275
- const source = Array.isArray(_source) ? _source : [..._source];
276
- const range = calcExtent(source);
277
- const divisor = range[1] - range[0] || 1;
278
- const normalizeMap = map((row) => (row - range[0]) / divisor);
279
- return yield* normalizeMap(source);
280
- };
281
- }
282
- __name(normalizeGen, "normalizeGen");
255
+ const calcExtent = scalar(extent());
256
+ return function* (_source) {
257
+ const source = Array.isArray(_source) ? _source : [..._source];
258
+ const range = calcExtent(source);
259
+ const divisor = range[1] - range[0] || 1;
260
+ return yield* map((row) => (row - range[0]) / divisor)(source);
261
+ };
262
+ }
283
263
  function normalize(s_or_undef) {
284
- return isSource(s_or_undef) ? normalizeGen()(s_or_undef) : normalizeGen();
264
+ return isSource(s_or_undef) ? normalizeGen()(s_or_undef) : normalizeGen();
285
265
  }
286
- __name(normalize, "normalize");
266
+
267
+ //#endregion
268
+ //#region src/activities/skip.ts
287
269
  function skipGen(n) {
288
- return function* (source) {
289
- let i = -1;
290
- for (const item of source) {
291
- if (++i >= n) {
292
- yield item;
293
- }
294
- }
295
- };
296
- }
297
- __name(skipGen, "skipGen");
270
+ return function* (source) {
271
+ let i = -1;
272
+ for (const item of source) if (++i >= n) yield item;
273
+ };
274
+ }
298
275
  function skip(s_or_n, n) {
299
- return isSource(s_or_n) ? skipGen(n)(s_or_n) : skipGen(s_or_n);
276
+ return isSource(s_or_n) ? skipGen(n)(s_or_n) : skipGen(s_or_n);
300
277
  }
301
- __name(skip, "skip");
278
+
279
+ //#endregion
280
+ //#region src/activities/sort.ts
302
281
  function sortGen(compareFn) {
303
- return function* (source) {
304
- yield* (Array.isArray(source) ? source : [...source]).sort(compareFn);
305
- };
282
+ return function* (source) {
283
+ yield* (Array.isArray(source) ? source : [...source]).sort(compareFn);
284
+ };
306
285
  }
307
- __name(sortGen, "sortGen");
308
286
  function sort(s_or_cb, callbackFn) {
309
- return isSource(s_or_cb) ? sortGen(callbackFn)(s_or_cb) : sortGen(s_or_cb);
287
+ return isSource(s_or_cb) ? sortGen(callbackFn)(s_or_cb) : sortGen(s_or_cb);
310
288
  }
311
- __name(sort, "sort");
289
+
290
+ //#endregion
291
+ //#region src/observers/count.ts
312
292
  function count() {
313
- let count2;
314
- return {
315
- observe: /* @__PURE__ */ __name((value, idx) => {
316
- if (idx === 0) {
317
- count2 = 0;
318
- }
319
- ++count2;
320
- }, "observe"),
321
- peek: /* @__PURE__ */ __name(() => count2, "peek")
322
- };
323
- }
324
- __name(count, "count");
293
+ let count$1;
294
+ return {
295
+ observe: (value, idx) => {
296
+ if (idx === 0) count$1 = 0;
297
+ ++count$1;
298
+ },
299
+ peek: () => count$1
300
+ };
301
+ }
302
+
303
+ //#endregion
304
+ //#region src/observers/variance.ts
325
305
  function _variance() {
326
- let count2;
327
- let mean2;
328
- let sum;
329
- return {
330
- observe: /* @__PURE__ */ __name((value, idx) => {
331
- if (idx === 0) {
332
- count2 = 0;
333
- mean2 = 0;
334
- sum = 0;
335
- }
336
- const delta = value - mean2;
337
- mean2 += delta / ++count2;
338
- sum += delta * (value - mean2);
339
- }, "observe"),
340
- peek: /* @__PURE__ */ __name(() => count2 > 1 ? sum / (count2 - 1) : void 0, "peek")
341
- };
342
- }
343
- __name(_variance, "_variance");
306
+ let count$1;
307
+ let mean$1;
308
+ let sum;
309
+ return {
310
+ observe: (value, idx) => {
311
+ if (idx === 0) {
312
+ count$1 = 0;
313
+ mean$1 = 0;
314
+ sum = 0;
315
+ }
316
+ const delta = value - mean$1;
317
+ mean$1 += delta / ++count$1;
318
+ sum += delta * (value - mean$1);
319
+ },
320
+ peek: () => count$1 > 1 ? sum / (count$1 - 1) : void 0
321
+ };
322
+ }
344
323
  function variance(callbackFn) {
345
- return callbackFn ? Accessor(_variance, callbackFn) : _variance();
324
+ return callbackFn ? Accessor(_variance, callbackFn) : _variance();
346
325
  }
347
- __name(variance, "variance");
326
+
327
+ //#endregion
328
+ //#region src/observers/deviation.ts
348
329
  function _deviation() {
349
- const v = variance();
350
- return {
351
- observe: /* @__PURE__ */ __name((value, idx) => {
352
- v.observe(value, idx);
353
- }, "observe"),
354
- peek: /* @__PURE__ */ __name(() => {
355
- const variance2 = v.peek();
356
- return variance2 !== void 0 ? Math.sqrt(variance2) : variance2;
357
- }, "peek")
358
- };
359
- }
360
- __name(_deviation, "_deviation");
330
+ const v = variance();
331
+ return {
332
+ observe: (value, idx) => {
333
+ v.observe(value, idx);
334
+ },
335
+ peek: () => {
336
+ const variance$1 = v.peek();
337
+ return variance$1 !== void 0 ? Math.sqrt(variance$1) : variance$1;
338
+ }
339
+ };
340
+ }
361
341
  function deviation(callbackFn) {
362
- return callbackFn ? Accessor(_deviation, callbackFn) : _deviation();
342
+ return callbackFn ? Accessor(_deviation, callbackFn) : _deviation();
363
343
  }
364
- __name(deviation, "deviation");
344
+
345
+ //#endregion
346
+ //#region src/observers/mean.ts
365
347
  function _mean() {
366
- let total;
367
- let count2;
368
- return {
369
- observe: /* @__PURE__ */ __name((value, idx) => {
370
- if (idx === 0) {
371
- total = value;
372
- } else {
373
- total += value;
374
- }
375
- count2 = idx;
376
- }, "observe"),
377
- peek: /* @__PURE__ */ __name(() => total / (count2 + 1), "peek")
378
- };
379
- }
380
- __name(_mean, "_mean");
348
+ let total;
349
+ let count$1;
350
+ return {
351
+ observe: (value, idx) => {
352
+ if (idx === 0) total = value;
353
+ else total += value;
354
+ count$1 = idx;
355
+ },
356
+ peek: () => total / (count$1 + 1)
357
+ };
358
+ }
381
359
  function mean(callbackFn) {
382
- return callbackFn ? Accessor(_mean, callbackFn) : _mean();
360
+ return callbackFn ? Accessor(_mean, callbackFn) : _mean();
383
361
  }
384
- __name(mean, "mean");
362
+
363
+ //#endregion
364
+ //#region src/observers/distribution.ts
385
365
  function _distribution() {
386
- const minFO = min();
387
- const maxFO = max();
388
- const meanFO = mean();
389
- const varianceFO = variance();
390
- return {
391
- observe: /* @__PURE__ */ __name((value, idx) => {
392
- minFO.observe(value, idx);
393
- maxFO.observe(value, idx);
394
- meanFO.observe(value, idx);
395
- varianceFO.observe(value, idx);
396
- }, "observe"),
397
- peek: /* @__PURE__ */ __name(() => {
398
- const minResult = minFO.peek();
399
- if (minResult === void 0) return void 0;
400
- const varianceResult = varianceFO.peek();
401
- return {
402
- min: minResult,
403
- max: maxFO.peek(),
404
- mean: meanFO.peek(),
405
- variance: varianceResult,
406
- deviation: varianceResult !== void 0 ? Math.sqrt(varianceResult) : void 0
407
- };
408
- }, "peek")
409
- };
410
- }
411
- __name(_distribution, "_distribution");
366
+ const minFO = min();
367
+ const maxFO = max();
368
+ const meanFO = mean();
369
+ const varianceFO = variance();
370
+ return {
371
+ observe: (value, idx) => {
372
+ minFO.observe(value, idx);
373
+ maxFO.observe(value, idx);
374
+ meanFO.observe(value, idx);
375
+ varianceFO.observe(value, idx);
376
+ },
377
+ peek: () => {
378
+ const minResult = minFO.peek();
379
+ if (minResult === void 0) return void 0;
380
+ const varianceResult = varianceFO.peek();
381
+ return {
382
+ min: minResult,
383
+ max: maxFO.peek(),
384
+ mean: meanFO.peek(),
385
+ variance: varianceResult,
386
+ deviation: varianceResult !== void 0 ? Math.sqrt(varianceResult) : void 0
387
+ };
388
+ }
389
+ };
390
+ }
412
391
  function distribution(callbackFn) {
413
- return callbackFn ? Accessor(_distribution, callbackFn) : _distribution();
392
+ return callbackFn ? Accessor(_distribution, callbackFn) : _distribution();
414
393
  }
415
- __name(distribution, "distribution");
394
+
395
+ //#endregion
396
+ //#region src/observers/median.ts
416
397
  function _median() {
417
- let values;
418
- return {
419
- observe: /* @__PURE__ */ __name((value, idx) => {
420
- if (idx === 0) {
421
- values = [];
422
- }
423
- values.push(value);
424
- }, "observe"),
425
- peek: /* @__PURE__ */ __name(() => {
426
- const sorted = values.sort((l, r) => l - r);
427
- const mid = sorted.length / 2;
428
- if (sorted.length % 2 === 0) {
429
- return (sorted[mid - 1] + sorted[mid]) / 2;
430
- } else {
431
- return sorted[Math.floor(mid)];
432
- }
433
- }, "peek")
434
- };
435
- }
436
- __name(_median, "_median");
398
+ let values;
399
+ return {
400
+ observe: (value, idx) => {
401
+ if (idx === 0) values = [];
402
+ values.push(value);
403
+ },
404
+ peek: () => {
405
+ const sorted = values.sort((l, r) => l - r);
406
+ const mid = sorted.length / 2;
407
+ if (sorted.length % 2 === 0) return (sorted[mid - 1] + sorted[mid]) / 2;
408
+ else return sorted[Math.floor(mid)];
409
+ }
410
+ };
411
+ }
437
412
  function median(callbackFn) {
438
- return callbackFn ? Accessor(_median, callbackFn) : _median();
413
+ return callbackFn ? Accessor(_median, callbackFn) : _median();
439
414
  }
440
- __name(median, "median");
415
+
416
+ //#endregion
417
+ //#region src/observers/quartile.ts
441
418
  function _quartile() {
442
- let values;
443
- return {
444
- observe: /* @__PURE__ */ __name((value, idx) => {
445
- if (idx === 0) {
446
- values = [];
447
- }
448
- values.push(value);
449
- }, "observe"),
450
- peek: /* @__PURE__ */ __name(() => {
451
- const sorted = values.sort((l, r) => l - r);
452
- const mid = sorted.length / 2;
453
- let medianVal;
454
- let lower;
455
- let upper;
456
- if (sorted.length < 2) {
457
- return void 0;
458
- } else if (sorted.length % 2 === 0) {
459
- medianVal = (sorted[mid - 1] + sorted[mid]) / 2;
460
- lower = sorted.slice(0, mid);
461
- upper = sorted.slice(mid);
462
- } else {
463
- medianVal = sorted[Math.floor(mid)];
464
- lower = sorted.slice(0, Math.floor(mid));
465
- upper = sorted.slice(Math.ceil(mid));
466
- }
467
- return [sorted[0], scalar(median())(lower), medianVal, scalar(median())(upper), sorted[sorted.length - 1]];
468
- }, "peek")
469
- };
470
- }
471
- __name(_quartile, "_quartile");
419
+ let values;
420
+ return {
421
+ observe: (value, idx) => {
422
+ if (idx === 0) values = [];
423
+ values.push(value);
424
+ },
425
+ peek: () => {
426
+ const sorted = values.sort((l, r) => l - r);
427
+ const mid = sorted.length / 2;
428
+ let medianVal;
429
+ let lower;
430
+ let upper;
431
+ if (sorted.length < 2) return;
432
+ else if (sorted.length % 2 === 0) {
433
+ medianVal = (sorted[mid - 1] + sorted[mid]) / 2;
434
+ lower = sorted.slice(0, mid);
435
+ upper = sorted.slice(mid);
436
+ } else {
437
+ medianVal = sorted[Math.floor(mid)];
438
+ lower = sorted.slice(0, Math.floor(mid));
439
+ upper = sorted.slice(Math.ceil(mid));
440
+ }
441
+ return [
442
+ sorted[0],
443
+ scalar(median())(lower),
444
+ medianVal,
445
+ scalar(median())(upper),
446
+ sorted[sorted.length - 1]
447
+ ];
448
+ }
449
+ };
450
+ }
472
451
  function quartile(callbackFn) {
473
- return callbackFn ? Accessor(_quartile, callbackFn) : _quartile();
452
+ return callbackFn ? Accessor(_quartile, callbackFn) : _quartile();
474
453
  }
475
- __name(quartile, "quartile");
454
+
455
+ //#endregion
456
+ //#region src/observers/reduce.ts
476
457
  function _reduce(callback, initialValue) {
477
- let reduced;
478
- return {
479
- observe: /* @__PURE__ */ __name((value, idx) => {
480
- if (idx === 0) {
481
- reduced = initialValue === void 0 ? value : callback(initialValue, value, idx);
482
- } else {
483
- reduced = callback(reduced, value, idx);
484
- }
485
- }, "observe"),
486
- peek: /* @__PURE__ */ __name(() => reduced, "peek")
487
- };
488
- }
489
- __name(_reduce, "_reduce");
458
+ let reduced;
459
+ return {
460
+ observe: (value, idx) => {
461
+ if (idx === 0) reduced = initialValue === void 0 ? value : callback(initialValue, value, idx);
462
+ else reduced = callback(reduced, value, idx);
463
+ },
464
+ peek: () => reduced
465
+ };
466
+ }
490
467
  function reduce(callbackFn, initialValue) {
491
- return _reduce(callbackFn, initialValue);
468
+ return _reduce(callbackFn, initialValue);
492
469
  }
493
- __name(reduce, "reduce");
470
+
471
+ //#endregion
472
+ //#region src/utils/generate.ts
494
473
  function* generate(generatorFn, maxLen) {
495
- let i = -1;
496
- while (maxLen === void 0 || ++i < maxLen) {
497
- yield generatorFn();
498
- }
499
- }
500
- __name(generate, "generate");
501
- const GeneratorFunction = (function* () {
502
- }).constructor;
474
+ let i = -1;
475
+ while (maxLen === void 0 || ++i < maxLen) yield generatorFn();
476
+ }
477
+
478
+ //#endregion
479
+ //#region src/utils/pipe.ts
480
+ var GeneratorFunction = (function* () {}).constructor;
503
481
  function chainGen(...items) {
504
- if (items[items.length - 1] instanceof GeneratorFunction) {
505
- return function* (source) {
506
- let tail = source;
507
- for (const activity2 of items) {
508
- tail = activity2(tail);
509
- }
510
- yield* tail;
511
- };
512
- } else {
513
- return function(source) {
514
- let tail = source;
515
- for (const activity2 of items) {
516
- tail = activity2(tail);
517
- }
518
- return tail;
519
- };
520
- }
521
- }
522
- __name(chainGen, "chainGen");
482
+ if (items[items.length - 1] instanceof GeneratorFunction) return function* (source) {
483
+ let tail = source;
484
+ for (const activity$1 of items) tail = activity$1(tail);
485
+ yield* tail;
486
+ };
487
+ else return function(source) {
488
+ let tail = source;
489
+ for (const activity$1 of items) tail = activity$1(tail);
490
+ return tail;
491
+ };
492
+ }
523
493
  function pipe(s_or_ia, ...items) {
524
- return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia, ...items);
494
+ return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia, ...items);
525
495
  }
526
- __name(pipe, "pipe");
527
496
  const chain = pipe;
528
- export {
529
- Accessor,
530
- activity,
531
- chain,
532
- concat,
533
- count,
534
- deviation,
535
- distribution,
536
- each,
537
- entries,
538
- extent,
539
- filter,
540
- first,
541
- generate,
542
- group,
543
- histogram,
544
- isSource,
545
- join,
546
- map,
547
- max,
548
- mean,
549
- median,
550
- min,
551
- normalize,
552
- pipe,
553
- quartile,
554
- reduce,
555
- scalar,
556
- sensor,
557
- skip,
558
- sort,
559
- variance
560
- };
561
- //# sourceMappingURL=index.js.map
497
+
498
+ //#endregion
499
+ export { Accessor, activity, chain, concat, count, deviation, distribution, each, entries, extent, filter, first, generate, group, histogram, isSource, join, map, max, mean, median, min, normalize, pipe, quartile, reduce, scalar, sensor, skip, sort, variance };
500
+ //# sourceMappingURL=index.js.map