@hpcc-js/dataflow 9.5.0 → 9.5.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/dist/index.js CHANGED
@@ -1,500 +1,561 @@
1
- //#region src/activities/activity.ts
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
3
  function isSource(source) {
3
- return source && (typeof source[Symbol.iterator] === "function" || Array.isArray(source));
4
+ return source && (typeof source[Symbol.iterator] === "function" || Array.isArray(source));
4
5
  }
5
-
6
- //#endregion
7
- //#region src/activities/concat.ts
6
+ __name(isSource, "isSource");
8
7
  function concatGen(concatSource) {
9
- return function* (source) {
10
- yield* source;
11
- yield* concatSource;
12
- };
8
+ return function* (source) {
9
+ yield* source;
10
+ yield* concatSource;
11
+ };
13
12
  }
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
-
18
- //#endregion
19
- //#region src/activities/each.ts
17
+ __name(concat, "concat");
20
18
  function eachGen(callbackFn) {
21
- return function* (source) {
22
- let i = -1;
23
- for (const item of source) {
24
- callbackFn(item, ++i);
25
- yield item;
26
- }
27
- };
28
- }
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");
29
28
  function each(s_or_cb, callbackFn) {
30
- return isSource(s_or_cb) ? eachGen(callbackFn)(s_or_cb) : eachGen(s_or_cb);
29
+ return isSource(s_or_cb) ? eachGen(callbackFn)(s_or_cb) : eachGen(s_or_cb);
31
30
  }
32
-
33
- //#endregion
34
- //#region src/activities/entries.ts
31
+ __name(each, "each");
35
32
  function entriesGen() {
36
- return function* (source) {
37
- let i = -1;
38
- for (const item of source) yield [++i, item];
39
- };
40
- }
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");
41
41
  function entries(source) {
42
- return source ? entriesGen()(source) : entriesGen();
42
+ return source ? entriesGen()(source) : entriesGen();
43
43
  }
44
-
45
- //#endregion
46
- //#region src/activities/filter.ts
44
+ __name(entries, "entries");
47
45
  function filterGen(callbackFn) {
48
- return function* (source) {
49
- let i = -1;
50
- for (const item of source) if (callbackFn(item, ++i)) yield item;
51
- };
52
- }
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");
53
56
  function filter(s_or_cb, callbackFn) {
54
- return isSource(s_or_cb) ? filterGen(callbackFn)(s_or_cb) : filterGen(s_or_cb);
57
+ return isSource(s_or_cb) ? filterGen(callbackFn)(s_or_cb) : filterGen(s_or_cb);
55
58
  }
56
-
57
- //#endregion
58
- //#region src/activities/first.ts
59
+ __name(filter, "filter");
59
60
  function firstGen(n) {
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
- }
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");
68
72
  function first(s_or_n, n) {
69
- if (!isSource(s_or_n)) return firstGen(s_or_n);
70
- return firstGen(n)(s_or_n);
73
+ if (!isSource(s_or_n)) return firstGen(s_or_n);
74
+ return firstGen(n)(s_or_n);
71
75
  }
72
-
73
- //#endregion
74
- //#region src/activities/group.ts
76
+ __name(first, "first");
75
77
  function groupGen(groupFn) {
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
- }
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");
90
94
  function group(s_or_gbf, groupByFn) {
91
- return isSource(s_or_gbf) ? groupGen(groupByFn)(s_or_gbf) : groupGen(s_or_gbf);
95
+ return isSource(s_or_gbf) ? groupGen(groupByFn)(s_or_gbf) : groupGen(s_or_gbf);
92
96
  }
93
-
94
- //#endregion
95
- //#region src/observers/observer.ts
97
+ __name(group, "group");
96
98
  function Accessor(fof, accesor) {
97
- const s = fof();
98
- return {
99
- observe: (_, i) => {
100
- s.observe(accesor(_, i), i);
101
- },
102
- peek: s.peek
103
- };
104
- }
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");
105
108
  function sensor(s) {
106
- return each((r, i) => s.observe(r, i));
109
+ return each((r, i) => s.observe(r, i));
107
110
  }
111
+ __name(sensor, "sensor");
108
112
  function activity(s) {
109
- return function* (source) {
110
- let i = -1;
111
- for (const row of source) s.observe(row, ++i);
112
- yield s.peek();
113
- };
114
- }
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");
115
122
  function scalar(s) {
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
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");
125
132
  function _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
- }
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");
135
146
  function max(callbackFn) {
136
- return callbackFn ? Accessor(_max, callbackFn) : _max();
147
+ return callbackFn ? Accessor(_max, callbackFn) : _max();
137
148
  }
138
-
139
- //#endregion
140
- //#region src/observers/min.ts
149
+ __name(max, "max");
141
150
  function _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
- }
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");
151
164
  function min(callbackFn) {
152
- return callbackFn ? Accessor(_min, callbackFn) : _min();
165
+ return callbackFn ? Accessor(_min, callbackFn) : _min();
153
166
  }
154
-
155
- //#endregion
156
- //#region src/observers/extent.ts
167
+ __name(min, "min");
157
168
  function _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
- }
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");
168
180
  function extent(callbackFn) {
169
- return callbackFn ? Accessor(_extent, callbackFn) : _extent();
181
+ return callbackFn ? Accessor(_extent, callbackFn) : _extent();
170
182
  }
171
-
172
- //#endregion
173
- //#region src/activities/histogram.ts
183
+ __name(extent, "extent");
174
184
  function isOptionA(_) {
175
- return _.buckets !== void 0;
185
+ return _.buckets !== void 0;
176
186
  }
187
+ __name(isOptionA, "isOptionA");
177
188
  function histogramGen(callbackFn, options) {
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
- }
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");
223
241
  function histogram(s_or_hf, hf_or_b, options) {
224
- return isSource(s_or_hf) ? histogramGen(hf_or_b, options)(s_or_hf) : histogramGen(s_or_hf, hf_or_b);
242
+ return isSource(s_or_hf) ? histogramGen(hf_or_b, options)(s_or_hf) : histogramGen(s_or_hf, hf_or_b);
225
243
  }
226
-
227
- //#endregion
228
- //#region src/activities/join.ts
244
+ __name(histogram, "histogram");
229
245
  function joinGen(_sourceU, callbackFn) {
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
- }
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");
236
255
  function join(sT_or_sU, sU_or_cb, callbackFn) {
237
- return isSource(sU_or_cb) ? joinGen(sU_or_cb, callbackFn)(sT_or_sU) : joinGen(sT_or_sU, sU_or_cb);
256
+ return isSource(sU_or_cb) ? joinGen(sU_or_cb, callbackFn)(sT_or_sU) : joinGen(sT_or_sU, sU_or_cb);
238
257
  }
239
-
240
- //#endregion
241
- //#region src/activities/map.ts
258
+ __name(join, "join");
242
259
  function mapGen(callbackFn) {
243
- return function* (source) {
244
- let i = -1;
245
- for (const item of source) yield callbackFn(item, ++i);
246
- };
247
- }
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");
248
268
  function map(s_or_cb, callbackFn) {
249
- return isSource(s_or_cb) ? mapGen(callbackFn)(s_or_cb) : mapGen(s_or_cb);
269
+ return isSource(s_or_cb) ? mapGen(callbackFn)(s_or_cb) : mapGen(s_or_cb);
250
270
  }
251
-
252
- //#endregion
253
- //#region src/activities/normalize.ts
271
+ __name(map, "map");
254
272
  function 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
- }
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");
263
283
  function normalize(s_or_undef) {
264
- return isSource(s_or_undef) ? normalizeGen()(s_or_undef) : normalizeGen();
284
+ return isSource(s_or_undef) ? normalizeGen()(s_or_undef) : normalizeGen();
265
285
  }
266
-
267
- //#endregion
268
- //#region src/activities/skip.ts
286
+ __name(normalize, "normalize");
269
287
  function skipGen(n) {
270
- return function* (source) {
271
- let i = -1;
272
- for (const item of source) if (++i >= n) yield item;
273
- };
274
- }
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");
275
298
  function skip(s_or_n, n) {
276
- return isSource(s_or_n) ? skipGen(n)(s_or_n) : skipGen(s_or_n);
299
+ return isSource(s_or_n) ? skipGen(n)(s_or_n) : skipGen(s_or_n);
277
300
  }
278
-
279
- //#endregion
280
- //#region src/activities/sort.ts
301
+ __name(skip, "skip");
281
302
  function sortGen(compareFn) {
282
- return function* (source) {
283
- yield* (Array.isArray(source) ? source : [...source]).sort(compareFn);
284
- };
303
+ return function* (source) {
304
+ yield* (Array.isArray(source) ? source : [...source]).sort(compareFn);
305
+ };
285
306
  }
307
+ __name(sortGen, "sortGen");
286
308
  function sort(s_or_cb, callbackFn) {
287
- return isSource(s_or_cb) ? sortGen(callbackFn)(s_or_cb) : sortGen(s_or_cb);
309
+ return isSource(s_or_cb) ? sortGen(callbackFn)(s_or_cb) : sortGen(s_or_cb);
288
310
  }
289
-
290
- //#endregion
291
- //#region src/observers/count.ts
311
+ __name(sort, "sort");
292
312
  function 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
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");
305
325
  function _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
- }
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");
323
344
  function variance(callbackFn) {
324
- return callbackFn ? Accessor(_variance, callbackFn) : _variance();
345
+ return callbackFn ? Accessor(_variance, callbackFn) : _variance();
325
346
  }
326
-
327
- //#endregion
328
- //#region src/observers/deviation.ts
347
+ __name(variance, "variance");
329
348
  function _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
- }
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");
341
361
  function deviation(callbackFn) {
342
- return callbackFn ? Accessor(_deviation, callbackFn) : _deviation();
362
+ return callbackFn ? Accessor(_deviation, callbackFn) : _deviation();
343
363
  }
344
-
345
- //#endregion
346
- //#region src/observers/mean.ts
364
+ __name(deviation, "deviation");
347
365
  function _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
- }
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");
359
381
  function mean(callbackFn) {
360
- return callbackFn ? Accessor(_mean, callbackFn) : _mean();
382
+ return callbackFn ? Accessor(_mean, callbackFn) : _mean();
361
383
  }
362
-
363
- //#endregion
364
- //#region src/observers/distribution.ts
384
+ __name(mean, "mean");
365
385
  function _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
- }
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");
391
412
  function distribution(callbackFn) {
392
- return callbackFn ? Accessor(_distribution, callbackFn) : _distribution();
413
+ return callbackFn ? Accessor(_distribution, callbackFn) : _distribution();
393
414
  }
394
-
395
- //#endregion
396
- //#region src/observers/median.ts
415
+ __name(distribution, "distribution");
397
416
  function _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
- }
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");
412
437
  function median(callbackFn) {
413
- return callbackFn ? Accessor(_median, callbackFn) : _median();
438
+ return callbackFn ? Accessor(_median, callbackFn) : _median();
414
439
  }
415
-
416
- //#endregion
417
- //#region src/observers/quartile.ts
440
+ __name(median, "median");
418
441
  function _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
- }
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");
451
472
  function quartile(callbackFn) {
452
- return callbackFn ? Accessor(_quartile, callbackFn) : _quartile();
473
+ return callbackFn ? Accessor(_quartile, callbackFn) : _quartile();
453
474
  }
454
-
455
- //#endregion
456
- //#region src/observers/reduce.ts
475
+ __name(quartile, "quartile");
457
476
  function _reduce(callback, initialValue) {
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
- }
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");
467
490
  function reduce(callbackFn, initialValue) {
468
- return _reduce(callbackFn, initialValue);
491
+ return _reduce(callbackFn, initialValue);
469
492
  }
470
-
471
- //#endregion
472
- //#region src/utils/generate.ts
493
+ __name(reduce, "reduce");
473
494
  function* generate(generatorFn, maxLen) {
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;
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;
481
503
  function chainGen(...items) {
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
- }
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");
493
523
  function pipe(s_or_ia, ...items) {
494
- return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia, ...items);
524
+ return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia, ...items);
495
525
  }
526
+ __name(pipe, "pipe");
496
527
  const chain = pipe;
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
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