@hpcc-js/dataflow 8.1.1 → 8.1.2
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/LICENSE +43 -43
- package/README.md +530 -530
- package/dist/index.js +443 -443
- package/dist/index.js.map +1 -1
- package/dist/index.min.js.map +1 -1
- package/lib-es6/__package__.js +3 -3
- package/lib-es6/__package__.js.map +1 -1
- package/lib-es6/__tests__/chain.js +48 -48
- package/lib-es6/__tests__/concat.js +16 -16
- package/lib-es6/__tests__/count.js +18 -18
- package/lib-es6/__tests__/data.js +55 -55
- package/lib-es6/__tests__/deviation.js +12 -12
- package/lib-es6/__tests__/distribution.js +18 -18
- package/lib-es6/__tests__/each.js +11 -11
- package/lib-es6/__tests__/entries.js +12 -12
- package/lib-es6/__tests__/extent.js +18 -18
- package/lib-es6/__tests__/filter.js +13 -13
- package/lib-es6/__tests__/first.js +13 -13
- package/lib-es6/__tests__/generate.js +7 -7
- package/lib-es6/__tests__/group.js +17 -17
- package/lib-es6/__tests__/histogram.js +41 -41
- package/lib-es6/__tests__/map.js +13 -13
- package/lib-es6/__tests__/max.js +29 -29
- package/lib-es6/__tests__/mean.js +9 -9
- package/lib-es6/__tests__/median.js +12 -12
- package/lib-es6/__tests__/min.js +29 -29
- package/lib-es6/__tests__/quartile.js +11 -11
- package/lib-es6/__tests__/readme.js +95 -95
- package/lib-es6/__tests__/readme.js.map +1 -1
- package/lib-es6/__tests__/reduce.js +14 -14
- package/lib-es6/__tests__/skip.js +13 -13
- package/lib-es6/__tests__/sort.js +18 -18
- package/lib-es6/__tests__/variance.js +12 -12
- package/lib-es6/activities/activity.js +3 -3
- package/lib-es6/activities/concat.js +9 -9
- package/lib-es6/activities/each.js +13 -13
- package/lib-es6/activities/entries.js +12 -12
- package/lib-es6/activities/filter.js +14 -14
- package/lib-es6/activities/first.js +17 -17
- package/lib-es6/activities/group.js +20 -20
- package/lib-es6/activities/histogram.js +63 -63
- package/lib-es6/activities/map.js +12 -12
- package/lib-es6/activities/skip.js +16 -16
- package/lib-es6/activities/sort.js +9 -9
- package/lib-es6/index.js +25 -25
- package/lib-es6/observers/count.js +12 -12
- package/lib-es6/observers/deviation.js +17 -17
- package/lib-es6/observers/distribution.js +35 -35
- package/lib-es6/observers/extent.js +17 -17
- package/lib-es6/observers/max.js +18 -18
- package/lib-es6/observers/mean.js +20 -20
- package/lib-es6/observers/median.js +25 -25
- package/lib-es6/observers/min.js +18 -18
- package/lib-es6/observers/observer.js +34 -34
- package/lib-es6/observers/quartile.js +37 -37
- package/lib-es6/observers/reduce.js +17 -17
- package/lib-es6/observers/variance.js +22 -22
- package/lib-es6/utils/generate.js +6 -6
- package/lib-es6/utils/pipe.js +31 -31
- package/package.json +3 -3
- package/src/__package__.ts +3 -3
- package/src/__tests__/chain.ts +85 -85
- package/src/__tests__/concat.ts +18 -18
- package/src/__tests__/count.ts +25 -25
- package/src/__tests__/data.ts +64 -64
- package/src/__tests__/deviation.ts +14 -14
- package/src/__tests__/distribution.ts +21 -21
- package/src/__tests__/each.ts +13 -13
- package/src/__tests__/entries.ts +14 -14
- package/src/__tests__/extent.ts +25 -25
- package/src/__tests__/filter.ts +16 -16
- package/src/__tests__/first.ts +15 -15
- package/src/__tests__/generate.ts +9 -9
- package/src/__tests__/group.ts +19 -19
- package/src/__tests__/histogram.ts +47 -47
- package/src/__tests__/map.ts +16 -16
- package/src/__tests__/max.ts +42 -42
- package/src/__tests__/mean.ts +11 -11
- package/src/__tests__/median.ts +14 -14
- package/src/__tests__/min.ts +42 -42
- package/src/__tests__/quartile.ts +14 -14
- package/src/__tests__/readme.ts +113 -113
- package/src/__tests__/reduce.ts +17 -17
- package/src/__tests__/skip.ts +15 -15
- package/src/__tests__/sort.ts +21 -21
- package/src/__tests__/variance.ts +14 -14
- package/src/activities/activity.ts +8 -8
- package/src/activities/concat.ts +14 -14
- package/src/activities/each.ts +19 -19
- package/src/activities/entries.ts +17 -17
- package/src/activities/filter.ts +20 -20
- package/src/activities/first.ts +20 -20
- package/src/activities/group.ts +27 -27
- package/src/activities/histogram.ts +78 -78
- package/src/activities/map.ts +18 -18
- package/src/activities/skip.ts +19 -19
- package/src/activities/sort.ts +16 -16
- package/src/index.ts +25 -25
- package/src/observers/count.ts +15 -15
- package/src/observers/deviation.ts +24 -24
- package/src/observers/distribution.ts +51 -51
- package/src/observers/extent.ts +24 -24
- package/src/observers/max.ts +24 -24
- package/src/observers/mean.ts +26 -26
- package/src/observers/median.ts +30 -30
- package/src/observers/min.ts +24 -24
- package/src/observers/observer.ts +52 -52
- package/src/observers/quartile.ts +43 -43
- package/src/observers/reduce.ts +22 -22
- package/src/observers/variance.ts +29 -29
- package/src/utils/generate.ts +6 -6
- package/src/utils/pipe.ts +74 -74
- package/types/__package__.d.ts +3 -3
- package/types/__package__.d.ts.map +1 -1
- package/types/__tests__/chain.d.ts +1 -1
- package/types/__tests__/concat.d.ts +1 -1
- package/types/__tests__/count.d.ts +1 -1
- package/types/__tests__/data.d.ts +61 -61
- package/types/__tests__/deviation.d.ts +1 -1
- package/types/__tests__/distribution.d.ts +1 -1
- package/types/__tests__/each.d.ts +1 -1
- package/types/__tests__/entries.d.ts +1 -1
- package/types/__tests__/extent.d.ts +1 -1
- package/types/__tests__/filter.d.ts +1 -1
- package/types/__tests__/first.d.ts +1 -1
- package/types/__tests__/generate.d.ts +1 -1
- package/types/__tests__/group.d.ts +1 -1
- package/types/__tests__/histogram.d.ts +1 -1
- package/types/__tests__/map.d.ts +1 -1
- package/types/__tests__/max.d.ts +1 -1
- package/types/__tests__/mean.d.ts +1 -1
- package/types/__tests__/median.d.ts +1 -1
- package/types/__tests__/min.d.ts +1 -1
- package/types/__tests__/quartile.d.ts +1 -1
- package/types/__tests__/readme.d.ts +1 -1
- package/types/__tests__/reduce.d.ts +1 -1
- package/types/__tests__/skip.d.ts +1 -1
- package/types/__tests__/sort.d.ts +1 -1
- package/types/__tests__/variance.d.ts +1 -1
- package/types/activities/activity.d.ts +5 -5
- package/types/activities/concat.d.ts +3 -3
- package/types/activities/each.d.ts +4 -4
- package/types/activities/entries.d.ts +3 -3
- package/types/activities/filter.d.ts +4 -4
- package/types/activities/first.d.ts +3 -3
- package/types/activities/group.d.ts +8 -8
- package/types/activities/histogram.d.ts +17 -17
- package/types/activities/map.d.ts +4 -4
- package/types/activities/skip.d.ts +3 -3
- package/types/activities/sort.d.ts +4 -4
- package/types/index.d.ts +25 -25
- package/types/observers/count.d.ts +2 -2
- package/types/observers/deviation.d.ts +4 -4
- package/types/observers/distribution.d.ts +12 -12
- package/types/observers/extent.d.ts +4 -4
- package/types/observers/max.d.ts +4 -4
- package/types/observers/mean.d.ts +4 -4
- package/types/observers/median.d.ts +4 -4
- package/types/observers/min.d.ts +4 -4
- package/types/observers/observer.d.ts +13 -13
- package/types/observers/quartile.d.ts +5 -5
- package/types/observers/reduce.d.ts +3 -3
- package/types/observers/variance.d.ts +4 -4
- package/types/utils/generate.d.ts +1 -1
- package/types/utils/pipe.d.ts +41 -41
- package/types-3.4/__package__.d.ts +2 -2
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { each } from "../activities/each";
|
|
2
|
-
export function Accessor(fof, accesor) {
|
|
3
|
-
const s = fof();
|
|
4
|
-
return {
|
|
5
|
-
observe: (_, i) => {
|
|
6
|
-
s.observe(accesor(_, i), i);
|
|
7
|
-
},
|
|
8
|
-
peek: s.peek
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
// This is an pass through activity so a FlowObserver can be inserted into a pipeline ---
|
|
12
|
-
export function sensor(s) {
|
|
13
|
-
return each((r, i) => s.observe(r, i));
|
|
14
|
-
}
|
|
15
|
-
// This converts a FlowObserver to an Activity ---
|
|
16
|
-
export function activity(s) {
|
|
17
|
-
return function* (source) {
|
|
18
|
-
let i = -1;
|
|
19
|
-
for (const row of source) {
|
|
20
|
-
s.observe(row, ++i);
|
|
21
|
-
}
|
|
22
|
-
yield s.peek();
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
// This converts a FlowObserver to an ScalarActivity ---
|
|
26
|
-
export function scalar(s) {
|
|
27
|
-
return function (source) {
|
|
28
|
-
let i = -1;
|
|
29
|
-
for (const row of source) {
|
|
30
|
-
s.observe(row, ++i);
|
|
31
|
-
}
|
|
32
|
-
return s.peek();
|
|
33
|
-
};
|
|
34
|
-
}
|
|
1
|
+
import { each } from "../activities/each";
|
|
2
|
+
export function Accessor(fof, accesor) {
|
|
3
|
+
const s = fof();
|
|
4
|
+
return {
|
|
5
|
+
observe: (_, i) => {
|
|
6
|
+
s.observe(accesor(_, i), i);
|
|
7
|
+
},
|
|
8
|
+
peek: s.peek
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
// This is an pass through activity so a FlowObserver can be inserted into a pipeline ---
|
|
12
|
+
export function sensor(s) {
|
|
13
|
+
return each((r, i) => s.observe(r, i));
|
|
14
|
+
}
|
|
15
|
+
// This converts a FlowObserver to an Activity ---
|
|
16
|
+
export function activity(s) {
|
|
17
|
+
return function* (source) {
|
|
18
|
+
let i = -1;
|
|
19
|
+
for (const row of source) {
|
|
20
|
+
s.observe(row, ++i);
|
|
21
|
+
}
|
|
22
|
+
yield s.peek();
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
// This converts a FlowObserver to an ScalarActivity ---
|
|
26
|
+
export function scalar(s) {
|
|
27
|
+
return function (source) {
|
|
28
|
+
let i = -1;
|
|
29
|
+
for (const row of source) {
|
|
30
|
+
s.observe(row, ++i);
|
|
31
|
+
}
|
|
32
|
+
return s.peek();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
35
|
//# sourceMappingURL=observer.js.map
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { median } from "./median";
|
|
2
|
-
import { Accessor, scalar } from "./observer";
|
|
3
|
-
function _quartile() {
|
|
4
|
-
let values;
|
|
5
|
-
return {
|
|
6
|
-
observe: (value, idx) => {
|
|
7
|
-
if (idx === 0) {
|
|
8
|
-
values = [];
|
|
9
|
-
}
|
|
10
|
-
values.push(value);
|
|
11
|
-
},
|
|
12
|
-
peek: () => {
|
|
13
|
-
const sorted = values.sort((l, r) => l - r);
|
|
14
|
-
const mid = sorted.length / 2;
|
|
15
|
-
let medianVal;
|
|
16
|
-
let lower;
|
|
17
|
-
let upper;
|
|
18
|
-
if (sorted.length < 2) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
else if (sorted.length % 2 === 0) {
|
|
22
|
-
medianVal = (sorted[mid - 1] + sorted[mid]) / 2;
|
|
23
|
-
lower = sorted.slice(0, mid);
|
|
24
|
-
upper = sorted.slice(mid);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
medianVal = sorted[Math.floor(mid)];
|
|
28
|
-
lower = sorted.slice(0, Math.floor(mid));
|
|
29
|
-
upper = sorted.slice(Math.ceil(mid));
|
|
30
|
-
}
|
|
31
|
-
return [sorted[0], scalar(median())(lower), medianVal, scalar(median())(upper), sorted[sorted.length - 1]];
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export function quartile(callbackFn) {
|
|
36
|
-
return callbackFn ? Accessor(_quartile, callbackFn) : _quartile();
|
|
37
|
-
}
|
|
1
|
+
import { median } from "./median";
|
|
2
|
+
import { Accessor, scalar } from "./observer";
|
|
3
|
+
function _quartile() {
|
|
4
|
+
let values;
|
|
5
|
+
return {
|
|
6
|
+
observe: (value, idx) => {
|
|
7
|
+
if (idx === 0) {
|
|
8
|
+
values = [];
|
|
9
|
+
}
|
|
10
|
+
values.push(value);
|
|
11
|
+
},
|
|
12
|
+
peek: () => {
|
|
13
|
+
const sorted = values.sort((l, r) => l - r);
|
|
14
|
+
const mid = sorted.length / 2;
|
|
15
|
+
let medianVal;
|
|
16
|
+
let lower;
|
|
17
|
+
let upper;
|
|
18
|
+
if (sorted.length < 2) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
else if (sorted.length % 2 === 0) {
|
|
22
|
+
medianVal = (sorted[mid - 1] + sorted[mid]) / 2;
|
|
23
|
+
lower = sorted.slice(0, mid);
|
|
24
|
+
upper = sorted.slice(mid);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
medianVal = sorted[Math.floor(mid)];
|
|
28
|
+
lower = sorted.slice(0, Math.floor(mid));
|
|
29
|
+
upper = sorted.slice(Math.ceil(mid));
|
|
30
|
+
}
|
|
31
|
+
return [sorted[0], scalar(median())(lower), medianVal, scalar(median())(upper), sorted[sorted.length - 1]];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function quartile(callbackFn) {
|
|
36
|
+
return callbackFn ? Accessor(_quartile, callbackFn) : _quartile();
|
|
37
|
+
}
|
|
38
38
|
//# sourceMappingURL=quartile.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
function _reduce(callback, initialValue) {
|
|
2
|
-
let reduced;
|
|
3
|
-
return {
|
|
4
|
-
observe: (value, idx) => {
|
|
5
|
-
if (idx === 0) {
|
|
6
|
-
reduced = initialValue === undefined ? value : callback(initialValue, value, idx);
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
reduced = callback(reduced, value, idx);
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
peek: () => reduced
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function reduce(callbackFn, initialValue) {
|
|
16
|
-
return _reduce(callbackFn, initialValue);
|
|
17
|
-
}
|
|
1
|
+
function _reduce(callback, initialValue) {
|
|
2
|
+
let reduced;
|
|
3
|
+
return {
|
|
4
|
+
observe: (value, idx) => {
|
|
5
|
+
if (idx === 0) {
|
|
6
|
+
reduced = initialValue === undefined ? value : callback(initialValue, value, idx);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
reduced = callback(reduced, value, idx);
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
peek: () => reduced
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function reduce(callbackFn, initialValue) {
|
|
16
|
+
return _reduce(callbackFn, initialValue);
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=reduce.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Accessor } from "./observer";
|
|
2
|
-
function _variance() {
|
|
3
|
-
let count;
|
|
4
|
-
let mean;
|
|
5
|
-
let sum;
|
|
6
|
-
return {
|
|
7
|
-
observe: (value, idx) => {
|
|
8
|
-
if (idx === 0) {
|
|
9
|
-
count = 0;
|
|
10
|
-
mean = 0;
|
|
11
|
-
sum = 0;
|
|
12
|
-
}
|
|
13
|
-
const delta = value - mean;
|
|
14
|
-
mean += delta / ++count;
|
|
15
|
-
sum += delta * (value - mean);
|
|
16
|
-
},
|
|
17
|
-
peek: () => count > 1 ? sum / (count - 1) : undefined
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export function variance(callbackFn) {
|
|
21
|
-
return callbackFn ? Accessor(_variance, callbackFn) : _variance();
|
|
22
|
-
}
|
|
1
|
+
import { Accessor } from "./observer";
|
|
2
|
+
function _variance() {
|
|
3
|
+
let count;
|
|
4
|
+
let mean;
|
|
5
|
+
let sum;
|
|
6
|
+
return {
|
|
7
|
+
observe: (value, idx) => {
|
|
8
|
+
if (idx === 0) {
|
|
9
|
+
count = 0;
|
|
10
|
+
mean = 0;
|
|
11
|
+
sum = 0;
|
|
12
|
+
}
|
|
13
|
+
const delta = value - mean;
|
|
14
|
+
mean += delta / ++count;
|
|
15
|
+
sum += delta * (value - mean);
|
|
16
|
+
},
|
|
17
|
+
peek: () => count > 1 ? sum / (count - 1) : undefined
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function variance(callbackFn) {
|
|
21
|
+
return callbackFn ? Accessor(_variance, callbackFn) : _variance();
|
|
22
|
+
}
|
|
23
23
|
//# sourceMappingURL=variance.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function* generate(generatorFn, maxLen) {
|
|
2
|
-
let i = -1;
|
|
3
|
-
while (maxLen === undefined || ++i < maxLen) {
|
|
4
|
-
yield generatorFn();
|
|
5
|
-
}
|
|
6
|
-
}
|
|
1
|
+
export function* generate(generatorFn, maxLen) {
|
|
2
|
+
let i = -1;
|
|
3
|
+
while (maxLen === undefined || ++i < maxLen) {
|
|
4
|
+
yield generatorFn();
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=generate.js.map
|
package/lib-es6/utils/pipe.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { isSource } from "../activities/activity";
|
|
2
|
-
const GeneratorFunction = (function* () { }).constructor;
|
|
3
|
-
function chainGen(...items) {
|
|
4
|
-
if (items[items.length - 1] instanceof GeneratorFunction) {
|
|
5
|
-
return function* (source) {
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
let tail = source;
|
|
8
|
-
for (const activity of items) {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
tail = activity(tail);
|
|
11
|
-
}
|
|
12
|
-
yield* tail;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return function (source) {
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
let tail = source;
|
|
19
|
-
for (const activity of items) {
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
tail = activity(tail);
|
|
22
|
-
}
|
|
23
|
-
return tail;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function pipe(s_or_ia, ...items) {
|
|
28
|
-
return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia, ...items);
|
|
29
|
-
}
|
|
30
|
-
// Maintain backward compatibility
|
|
31
|
-
export const chain = pipe;
|
|
1
|
+
import { isSource } from "../activities/activity";
|
|
2
|
+
const GeneratorFunction = (function* () { }).constructor;
|
|
3
|
+
function chainGen(...items) {
|
|
4
|
+
if (items[items.length - 1] instanceof GeneratorFunction) {
|
|
5
|
+
return function* (source) {
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
let tail = source;
|
|
8
|
+
for (const activity of items) {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
tail = activity(tail);
|
|
11
|
+
}
|
|
12
|
+
yield* tail;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return function (source) {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
let tail = source;
|
|
19
|
+
for (const activity of items) {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
tail = activity(tail);
|
|
22
|
+
}
|
|
23
|
+
return tail;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function pipe(s_or_ia, ...items) {
|
|
28
|
+
return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia, ...items);
|
|
29
|
+
}
|
|
30
|
+
// Maintain backward compatibility
|
|
31
|
+
export const chain = pipe;
|
|
32
32
|
//# sourceMappingURL=pipe.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/dataflow",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"description": "hpcc-js - Data Flow",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "lib-es6/index",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"build": "npm run compile-es6 && npm run bundle",
|
|
35
35
|
"watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch",
|
|
36
36
|
"stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
|
|
37
|
-
"lint": "eslint src
|
|
37
|
+
"lint": "eslint ./src",
|
|
38
38
|
"lint-fix": "eslint --fix src/**/*.ts",
|
|
39
39
|
"test": "mocha lib-umd/__tests__ --reporter spec",
|
|
40
40
|
"docs": "typedoc --options tdoptions.json .",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "bd452a4559c9e5790881521a332964eef36153b7"
|
|
62
62
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const PKG_NAME = "@hpcc-js/dataflow";
|
|
2
|
-
export const PKG_VERSION = "8.1.
|
|
3
|
-
export const BUILD_VERSION = "2.102.
|
|
1
|
+
export const PKG_NAME = "@hpcc-js/dataflow";
|
|
2
|
+
export const PKG_VERSION = "8.1.2";
|
|
3
|
+
export const BUILD_VERSION = "2.102.11";
|
package/src/__tests__/chain.ts
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { count } from "../observers/count";
|
|
3
|
-
import { concat, pipe, filter, min, max, map, each, generate, sensor, scalar, activity } from "../index";
|
|
4
|
-
import { person, Person, population } from "./data";
|
|
5
|
-
|
|
6
|
-
describe("chain", () => {
|
|
7
|
-
it("generator", () => {
|
|
8
|
-
const p = pipe(concat([3, 4, 5, 6]), concat([7, 8]));
|
|
9
|
-
expect([...p([1, 2])]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
10
|
-
const p2 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
|
|
11
|
-
expect([...p2([1, 2])]).to.deep.equal([2, 4, 6, 7, 8]);
|
|
12
|
-
const p3 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
|
|
13
|
-
expect([...p3([1, 2])]).to.deep.equal([2, 4, 6, 8]);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("fn", () => {
|
|
17
|
-
expect([...pipe([1, 2])]).to.deep.equal([1, 2]);
|
|
18
|
-
const p = pipe([1, 2], concat([3, 4, 5, 6]), concat([7, 8]));
|
|
19
|
-
expect([...p]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
20
|
-
const p2 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
|
|
21
|
-
expect([...p2]).to.deep.equal([2, 4, 6, 7, 8]);
|
|
22
|
-
const p3 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
|
|
23
|
-
expect([...p3]).to.deep.equal([2, 4, 6, 8]);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("activity", () => {
|
|
27
|
-
expect([...pipe(
|
|
28
|
-
concat([3, 4, 5, 6]),
|
|
29
|
-
concat([7, 8]),
|
|
30
|
-
activity(max())
|
|
31
|
-
)([1, 2])]).to.deep.equal([8]);
|
|
32
|
-
|
|
33
|
-
expect([...pipe(
|
|
34
|
-
[1, 2],
|
|
35
|
-
concat([3, 4, 5, 6]),
|
|
36
|
-
concat([7, -1, 8]),
|
|
37
|
-
activity(min())
|
|
38
|
-
)]).to.deep.equal([-1]);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("scalar", () => {
|
|
42
|
-
expect(pipe(
|
|
43
|
-
concat([3, 4, 5, 6]),
|
|
44
|
-
concat([7, 8]),
|
|
45
|
-
scalar(max())
|
|
46
|
-
)([1, 2])).to.equal(8);
|
|
47
|
-
|
|
48
|
-
expect(pipe(
|
|
49
|
-
[1, 2],
|
|
50
|
-
concat([3, 4, 5, 6]),
|
|
51
|
-
concat([7, -1, 8]),
|
|
52
|
-
scalar(min())
|
|
53
|
-
)).to.equal(-1);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("chain-all", () => {
|
|
57
|
-
const s1 = count();
|
|
58
|
-
const s2 = count();
|
|
59
|
-
const myPipeline = pipe(
|
|
60
|
-
map((_: Person) => ({ id: _.email, display: `The id is: ${_}`, ageBucket: Math.round(_.age / 10) })),
|
|
61
|
-
each(row => { /* do nothing */ }),
|
|
62
|
-
sensor(s1),
|
|
63
|
-
filter(_ => _.ageBucket !== 2),
|
|
64
|
-
sensor(s2)
|
|
65
|
-
);
|
|
66
|
-
expect([...myPipeline(generate(person, 1000))]).to.have.lengthOf(829);
|
|
67
|
-
expect(s1.peek()).to.equal(1000);
|
|
68
|
-
expect(s2.peek()).to.equal(829);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("sensor", () => {
|
|
72
|
-
const s1 = max(r => r.age);
|
|
73
|
-
const s2 = max(r => r.age);
|
|
74
|
-
const p1 = pipe(
|
|
75
|
-
sensor(s1),
|
|
76
|
-
filter(r => r.age < 30),
|
|
77
|
-
sensor(s2),
|
|
78
|
-
);
|
|
79
|
-
const data = [...p1(population)];
|
|
80
|
-
expect(data.length).to.equal(286);
|
|
81
|
-
expect(s1.peek()).to.equal(66);
|
|
82
|
-
expect(s2.peek()).to.equal(29);
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
});
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { count } from "../observers/count";
|
|
3
|
+
import { concat, pipe, filter, min, max, map, each, generate, sensor, scalar, activity } from "../index";
|
|
4
|
+
import { person, Person, population } from "./data";
|
|
5
|
+
|
|
6
|
+
describe("chain", () => {
|
|
7
|
+
it("generator", () => {
|
|
8
|
+
const p = pipe(concat([3, 4, 5, 6]), concat([7, 8]));
|
|
9
|
+
expect([...p([1, 2])]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
10
|
+
const p2 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
|
|
11
|
+
expect([...p2([1, 2])]).to.deep.equal([2, 4, 6, 7, 8]);
|
|
12
|
+
const p3 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
|
|
13
|
+
expect([...p3([1, 2])]).to.deep.equal([2, 4, 6, 8]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("fn", () => {
|
|
17
|
+
expect([...pipe([1, 2])]).to.deep.equal([1, 2]);
|
|
18
|
+
const p = pipe([1, 2], concat([3, 4, 5, 6]), concat([7, 8]));
|
|
19
|
+
expect([...p]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
20
|
+
const p2 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
|
|
21
|
+
expect([...p2]).to.deep.equal([2, 4, 6, 7, 8]);
|
|
22
|
+
const p3 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
|
|
23
|
+
expect([...p3]).to.deep.equal([2, 4, 6, 8]);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("activity", () => {
|
|
27
|
+
expect([...pipe(
|
|
28
|
+
concat([3, 4, 5, 6]),
|
|
29
|
+
concat([7, 8]),
|
|
30
|
+
activity(max())
|
|
31
|
+
)([1, 2])]).to.deep.equal([8]);
|
|
32
|
+
|
|
33
|
+
expect([...pipe(
|
|
34
|
+
[1, 2],
|
|
35
|
+
concat([3, 4, 5, 6]),
|
|
36
|
+
concat([7, -1, 8]),
|
|
37
|
+
activity(min())
|
|
38
|
+
)]).to.deep.equal([-1]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("scalar", () => {
|
|
42
|
+
expect(pipe(
|
|
43
|
+
concat([3, 4, 5, 6]),
|
|
44
|
+
concat([7, 8]),
|
|
45
|
+
scalar(max())
|
|
46
|
+
)([1, 2])).to.equal(8);
|
|
47
|
+
|
|
48
|
+
expect(pipe(
|
|
49
|
+
[1, 2],
|
|
50
|
+
concat([3, 4, 5, 6]),
|
|
51
|
+
concat([7, -1, 8]),
|
|
52
|
+
scalar(min())
|
|
53
|
+
)).to.equal(-1);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("chain-all", () => {
|
|
57
|
+
const s1 = count();
|
|
58
|
+
const s2 = count();
|
|
59
|
+
const myPipeline = pipe(
|
|
60
|
+
map((_: Person) => ({ id: _.email, display: `The id is: ${_}`, ageBucket: Math.round(_.age / 10) })),
|
|
61
|
+
each(row => { /* do nothing */ }),
|
|
62
|
+
sensor(s1),
|
|
63
|
+
filter(_ => _.ageBucket !== 2),
|
|
64
|
+
sensor(s2)
|
|
65
|
+
);
|
|
66
|
+
expect([...myPipeline(generate(person, 1000))]).to.have.lengthOf(829);
|
|
67
|
+
expect(s1.peek()).to.equal(1000);
|
|
68
|
+
expect(s2.peek()).to.equal(829);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("sensor", () => {
|
|
72
|
+
const s1 = max(r => r.age);
|
|
73
|
+
const s2 = max(r => r.age);
|
|
74
|
+
const p1 = pipe(
|
|
75
|
+
sensor(s1),
|
|
76
|
+
filter(r => r.age < 30),
|
|
77
|
+
sensor(s2),
|
|
78
|
+
);
|
|
79
|
+
const data = [...p1(population)];
|
|
80
|
+
expect(data.length).to.equal(286);
|
|
81
|
+
expect(s1.peek()).to.equal(66);
|
|
82
|
+
expect(s2.peek()).to.equal(29);
|
|
83
|
+
|
|
84
|
+
});
|
|
85
|
+
});
|
package/src/__tests__/concat.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { concat } from "../index";
|
|
3
|
-
|
|
4
|
-
describe("concat", () => {
|
|
5
|
-
it("generator", () => {
|
|
6
|
-
expect([...concat([])([])]).to.deep.equal([]);
|
|
7
|
-
expect([...concat([1, 2, 3])([])]).to.deep.equal([1, 2, 3]);
|
|
8
|
-
expect([...concat<number>([])([1, 2, 3])]).to.deep.equal([1, 2, 3]);
|
|
9
|
-
expect([...concat([4, 5, 6])([1, 2, 3])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("scalarActivity", () => {
|
|
13
|
-
expect([...concat([], [])]).to.deep.equal([]);
|
|
14
|
-
expect([...concat([], [1, 2, 3])]).to.deep.equal([1, 2, 3]);
|
|
15
|
-
expect([...concat([1, 2, 3], [])]).to.deep.equal([1, 2, 3]);
|
|
16
|
-
expect([...concat([1, 2, 3], [4, 5, 6])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { concat } from "../index";
|
|
3
|
+
|
|
4
|
+
describe("concat", () => {
|
|
5
|
+
it("generator", () => {
|
|
6
|
+
expect([...concat([])([])]).to.deep.equal([]);
|
|
7
|
+
expect([...concat([1, 2, 3])([])]).to.deep.equal([1, 2, 3]);
|
|
8
|
+
expect([...concat<number>([])([1, 2, 3])]).to.deep.equal([1, 2, 3]);
|
|
9
|
+
expect([...concat([4, 5, 6])([1, 2, 3])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("scalarActivity", () => {
|
|
13
|
+
expect([...concat([], [])]).to.deep.equal([]);
|
|
14
|
+
expect([...concat([], [1, 2, 3])]).to.deep.equal([1, 2, 3]);
|
|
15
|
+
expect([...concat([1, 2, 3], [])]).to.deep.equal([1, 2, 3]);
|
|
16
|
+
expect([...concat([1, 2, 3], [4, 5, 6])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
|
|
17
|
+
});
|
|
18
|
+
});
|
package/src/__tests__/count.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { pipe, filter, count, scalar, sensor } from "../index";
|
|
3
|
-
import { population } from "./data";
|
|
4
|
-
|
|
5
|
-
describe("count", () => {
|
|
6
|
-
|
|
7
|
-
it("Population", () => {
|
|
8
|
-
const s1 = count();
|
|
9
|
-
const s2 = count();
|
|
10
|
-
const p1 = pipe(
|
|
11
|
-
sensor(s1),
|
|
12
|
-
filter(r => r.age > 30),
|
|
13
|
-
sensor(s2),
|
|
14
|
-
);
|
|
15
|
-
const data = [...p1(population)];
|
|
16
|
-
expect(s1.peek()).to.equal(1000);
|
|
17
|
-
expect(s2.peek()).to.equal(699);
|
|
18
|
-
expect(data.length).to.equal(699);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("scalarActivity", () => {
|
|
22
|
-
const countActivity = scalar(count());
|
|
23
|
-
expect(countActivity([5, 1, 2, -3, 4])).to.equal(5);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { pipe, filter, count, scalar, sensor } from "../index";
|
|
3
|
+
import { population } from "./data";
|
|
4
|
+
|
|
5
|
+
describe("count", () => {
|
|
6
|
+
|
|
7
|
+
it("Population", () => {
|
|
8
|
+
const s1 = count();
|
|
9
|
+
const s2 = count();
|
|
10
|
+
const p1 = pipe(
|
|
11
|
+
sensor(s1),
|
|
12
|
+
filter(r => r.age > 30),
|
|
13
|
+
sensor(s2),
|
|
14
|
+
);
|
|
15
|
+
const data = [...p1(population)];
|
|
16
|
+
expect(s1.peek()).to.equal(1000);
|
|
17
|
+
expect(s2.peek()).to.equal(699);
|
|
18
|
+
expect(data.length).to.equal(699);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("scalarActivity", () => {
|
|
22
|
+
const countActivity = scalar(count());
|
|
23
|
+
expect(countActivity([5, 1, 2, -3, 4])).to.equal(5);
|
|
24
|
+
});
|
|
25
|
+
});
|