@hpcc-js/dataflow 7.0.0 → 8.1.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.
Files changed (166) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +530 -530
  3. package/dist/index.js +446 -446
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/lib-es6/__package__.js +3 -3
  8. package/lib-es6/__package__.js.map +1 -1
  9. package/lib-es6/__tests__/chain.js +48 -48
  10. package/lib-es6/__tests__/concat.js +16 -16
  11. package/lib-es6/__tests__/count.js +18 -18
  12. package/lib-es6/__tests__/data.js +55 -55
  13. package/lib-es6/__tests__/deviation.js +12 -12
  14. package/lib-es6/__tests__/distribution.js +18 -18
  15. package/lib-es6/__tests__/each.js +11 -11
  16. package/lib-es6/__tests__/entries.js +12 -12
  17. package/lib-es6/__tests__/extent.js +18 -18
  18. package/lib-es6/__tests__/filter.js +13 -13
  19. package/lib-es6/__tests__/first.js +13 -13
  20. package/lib-es6/__tests__/generate.js +7 -7
  21. package/lib-es6/__tests__/group.js +17 -17
  22. package/lib-es6/__tests__/histogram.js +41 -41
  23. package/lib-es6/__tests__/map.js +13 -13
  24. package/lib-es6/__tests__/max.js +29 -29
  25. package/lib-es6/__tests__/mean.js +9 -9
  26. package/lib-es6/__tests__/median.js +12 -12
  27. package/lib-es6/__tests__/min.js +29 -29
  28. package/lib-es6/__tests__/quartile.js +11 -11
  29. package/lib-es6/__tests__/readme.js +95 -95
  30. package/lib-es6/__tests__/reduce.js +14 -14
  31. package/lib-es6/__tests__/skip.js +13 -13
  32. package/lib-es6/__tests__/sort.js +18 -18
  33. package/lib-es6/__tests__/variance.js +12 -12
  34. package/lib-es6/activities/activity.js +3 -3
  35. package/lib-es6/activities/concat.js +9 -9
  36. package/lib-es6/activities/each.js +13 -13
  37. package/lib-es6/activities/entries.js +12 -12
  38. package/lib-es6/activities/filter.js +14 -14
  39. package/lib-es6/activities/first.js +17 -17
  40. package/lib-es6/activities/group.js +20 -20
  41. package/lib-es6/activities/histogram.js +63 -63
  42. package/lib-es6/activities/map.js +12 -12
  43. package/lib-es6/activities/skip.js +16 -16
  44. package/lib-es6/activities/sort.js +9 -9
  45. package/lib-es6/index.js +25 -25
  46. package/lib-es6/observers/count.js +12 -12
  47. package/lib-es6/observers/deviation.js +17 -17
  48. package/lib-es6/observers/distribution.js +35 -35
  49. package/lib-es6/observers/extent.js +17 -17
  50. package/lib-es6/observers/max.js +18 -18
  51. package/lib-es6/observers/mean.js +20 -20
  52. package/lib-es6/observers/median.js +25 -25
  53. package/lib-es6/observers/min.js +18 -18
  54. package/lib-es6/observers/observer.js +34 -34
  55. package/lib-es6/observers/quartile.js +37 -37
  56. package/lib-es6/observers/reduce.js +17 -17
  57. package/lib-es6/observers/variance.js +22 -22
  58. package/lib-es6/utils/generate.js +6 -6
  59. package/lib-es6/utils/pipe.js +31 -31
  60. package/package.json +8 -24
  61. package/src/__package__.ts +3 -3
  62. package/src/__tests__/chain.ts +85 -85
  63. package/src/__tests__/concat.ts +18 -18
  64. package/src/__tests__/count.ts +25 -25
  65. package/src/__tests__/data.ts +64 -64
  66. package/src/__tests__/deviation.ts +14 -14
  67. package/src/__tests__/distribution.ts +21 -21
  68. package/src/__tests__/each.ts +13 -13
  69. package/src/__tests__/entries.ts +14 -14
  70. package/src/__tests__/extent.ts +25 -25
  71. package/src/__tests__/filter.ts +16 -16
  72. package/src/__tests__/first.ts +15 -15
  73. package/src/__tests__/generate.ts +9 -9
  74. package/src/__tests__/group.ts +19 -19
  75. package/src/__tests__/histogram.ts +47 -47
  76. package/src/__tests__/map.ts +16 -16
  77. package/src/__tests__/max.ts +42 -42
  78. package/src/__tests__/mean.ts +11 -11
  79. package/src/__tests__/median.ts +14 -14
  80. package/src/__tests__/min.ts +42 -42
  81. package/src/__tests__/quartile.ts +14 -14
  82. package/src/__tests__/readme.ts +113 -113
  83. package/src/__tests__/reduce.ts +17 -17
  84. package/src/__tests__/skip.ts +15 -15
  85. package/src/__tests__/sort.ts +21 -21
  86. package/src/__tests__/variance.ts +14 -14
  87. package/src/activities/activity.ts +8 -8
  88. package/src/activities/concat.ts +14 -14
  89. package/src/activities/each.ts +19 -19
  90. package/src/activities/entries.ts +17 -17
  91. package/src/activities/filter.ts +20 -20
  92. package/src/activities/first.ts +20 -20
  93. package/src/activities/group.ts +27 -27
  94. package/src/activities/histogram.ts +78 -78
  95. package/src/activities/map.ts +18 -18
  96. package/src/activities/skip.ts +19 -19
  97. package/src/activities/sort.ts +16 -16
  98. package/src/index.ts +25 -25
  99. package/src/observers/count.ts +15 -15
  100. package/src/observers/deviation.ts +24 -24
  101. package/src/observers/distribution.ts +51 -51
  102. package/src/observers/extent.ts +24 -24
  103. package/src/observers/max.ts +24 -24
  104. package/src/observers/mean.ts +26 -26
  105. package/src/observers/median.ts +30 -30
  106. package/src/observers/min.ts +24 -24
  107. package/src/observers/observer.ts +52 -52
  108. package/src/observers/quartile.ts +43 -43
  109. package/src/observers/reduce.ts +22 -22
  110. package/src/observers/variance.ts +29 -29
  111. package/src/utils/generate.ts +6 -6
  112. package/src/utils/pipe.ts +74 -74
  113. package/types/__package__.d.ts +3 -3
  114. package/types/__package__.d.ts.map +1 -1
  115. package/types/__tests__/chain.d.ts +1 -1
  116. package/types/__tests__/concat.d.ts +1 -1
  117. package/types/__tests__/count.d.ts +1 -1
  118. package/types/__tests__/data.d.ts +61 -61
  119. package/types/__tests__/deviation.d.ts +1 -1
  120. package/types/__tests__/distribution.d.ts +1 -1
  121. package/types/__tests__/each.d.ts +1 -1
  122. package/types/__tests__/entries.d.ts +1 -1
  123. package/types/__tests__/extent.d.ts +1 -1
  124. package/types/__tests__/filter.d.ts +1 -1
  125. package/types/__tests__/first.d.ts +1 -1
  126. package/types/__tests__/generate.d.ts +1 -1
  127. package/types/__tests__/group.d.ts +1 -1
  128. package/types/__tests__/histogram.d.ts +1 -1
  129. package/types/__tests__/map.d.ts +1 -1
  130. package/types/__tests__/max.d.ts +1 -1
  131. package/types/__tests__/mean.d.ts +1 -1
  132. package/types/__tests__/median.d.ts +1 -1
  133. package/types/__tests__/min.d.ts +1 -1
  134. package/types/__tests__/quartile.d.ts +1 -1
  135. package/types/__tests__/readme.d.ts +1 -1
  136. package/types/__tests__/reduce.d.ts +1 -1
  137. package/types/__tests__/skip.d.ts +1 -1
  138. package/types/__tests__/sort.d.ts +1 -1
  139. package/types/__tests__/variance.d.ts +1 -1
  140. package/types/activities/activity.d.ts +5 -5
  141. package/types/activities/concat.d.ts +3 -3
  142. package/types/activities/each.d.ts +4 -4
  143. package/types/activities/entries.d.ts +3 -3
  144. package/types/activities/filter.d.ts +4 -4
  145. package/types/activities/first.d.ts +3 -3
  146. package/types/activities/group.d.ts +8 -8
  147. package/types/activities/histogram.d.ts +17 -17
  148. package/types/activities/map.d.ts +4 -4
  149. package/types/activities/skip.d.ts +3 -3
  150. package/types/activities/sort.d.ts +4 -4
  151. package/types/index.d.ts +25 -25
  152. package/types/observers/count.d.ts +2 -2
  153. package/types/observers/deviation.d.ts +4 -4
  154. package/types/observers/distribution.d.ts +12 -12
  155. package/types/observers/extent.d.ts +4 -4
  156. package/types/observers/max.d.ts +4 -4
  157. package/types/observers/mean.d.ts +4 -4
  158. package/types/observers/median.d.ts +4 -4
  159. package/types/observers/min.d.ts +4 -4
  160. package/types/observers/observer.d.ts +13 -13
  161. package/types/observers/quartile.d.ts +5 -5
  162. package/types/observers/reduce.d.ts +3 -3
  163. package/types/observers/variance.d.ts +4 -4
  164. package/types/utils/generate.d.ts +1 -1
  165. package/types/utils/pipe.d.ts +41 -41
  166. package/types-3.4/__package__.d.ts +2 -2
@@ -1,26 +1,26 @@
1
- import { Accessor } from "./observer";
2
- function _median() {
3
- let values;
4
- return {
5
- observe: (value, idx) => {
6
- if (idx === 0) {
7
- values = [];
8
- }
9
- values.push(value);
10
- },
11
- peek: () => {
12
- const sorted = values.sort((l, r) => l - r);
13
- const mid = sorted.length / 2;
14
- if (sorted.length % 2 === 0) {
15
- return (sorted[mid - 1] + sorted[mid]) / 2;
16
- }
17
- else {
18
- return sorted[Math.floor(mid)];
19
- }
20
- }
21
- };
22
- }
23
- export function median(callbackFn) {
24
- return callbackFn ? Accessor(_median, callbackFn) : _median();
25
- }
1
+ import { Accessor } from "./observer";
2
+ function _median() {
3
+ let values;
4
+ return {
5
+ observe: (value, idx) => {
6
+ if (idx === 0) {
7
+ values = [];
8
+ }
9
+ values.push(value);
10
+ },
11
+ peek: () => {
12
+ const sorted = values.sort((l, r) => l - r);
13
+ const mid = sorted.length / 2;
14
+ if (sorted.length % 2 === 0) {
15
+ return (sorted[mid - 1] + sorted[mid]) / 2;
16
+ }
17
+ else {
18
+ return sorted[Math.floor(mid)];
19
+ }
20
+ }
21
+ };
22
+ }
23
+ export function median(callbackFn) {
24
+ return callbackFn ? Accessor(_median, callbackFn) : _median();
25
+ }
26
26
  //# sourceMappingURL=median.js.map
@@ -1,19 +1,19 @@
1
- import { Accessor } from "./observer";
2
- function _min() {
3
- let min;
4
- return {
5
- observe: (value, idx) => {
6
- if (idx === 0) {
7
- min = value;
8
- }
9
- else if (min > value) {
10
- min = value;
11
- }
12
- },
13
- peek: () => min
14
- };
15
- }
16
- export function min(callbackFn) {
17
- return callbackFn ? Accessor(_min, callbackFn) : _min();
18
- }
1
+ import { Accessor } from "./observer";
2
+ function _min() {
3
+ let min;
4
+ return {
5
+ observe: (value, idx) => {
6
+ if (idx === 0) {
7
+ min = value;
8
+ }
9
+ else if (min > value) {
10
+ min = value;
11
+ }
12
+ },
13
+ peek: () => min
14
+ };
15
+ }
16
+ export function min(callbackFn) {
17
+ return callbackFn ? Accessor(_min, callbackFn) : _min();
18
+ }
19
19
  //# sourceMappingURL=min.js.map
@@ -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
@@ -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": "7.0.0",
3
+ "version": "8.1.1",
4
4
  "description": "hpcc-js - Data Flow",
5
5
  "main": "dist/index.js",
6
6
  "module": "lib-es6/index",
@@ -33,35 +33,19 @@
33
33
  "gen-legacy-types": "downlevel-dts ./types ./types-3.4",
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
- "stamp": "node node_modules/@hpcc-js/bundle/src/stamp.js",
36
+ "stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
37
37
  "lint": "eslint src/**/*.ts",
38
38
  "lint-fix": "eslint --fix src/**/*.ts",
39
- "test": "./node_modules/.bin/mocha lib-umd/__tests__ --reporter spec",
40
- "docs": "typedoc --options tdoptions.json ."
39
+ "test": "mocha lib-umd/__tests__ --reporter spec",
40
+ "docs": "typedoc --options tdoptions.json .",
41
+ "update": "npx npm-check-updates -u -t minor"
41
42
  },
42
43
  "devDependencies": {
43
- "@hpcc-js/bundle": "^2.10.20",
44
- "@rollup/plugin-alias": "3.1.0",
45
- "@rollup/plugin-commonjs": "12.0.0",
46
- "@rollup/plugin-node-resolve": "8.0.0",
47
- "@types/chai": "4.1.7",
44
+ "@hpcc-js/bundle": "^2.11.1",
48
45
  "@types/faker": "4.1.12",
49
46
  "@types/mocha": "5.2.7",
50
- "@typescript-eslint/eslint-plugin": "4.31.0",
51
- "@typescript-eslint/parser": "4.31.0",
52
- "chai": "4.2.0",
53
- "downlevel-dts": "0.6.0",
54
- "eslint": "7.32.0",
55
47
  "faker": "4.1.0",
56
- "mocha": "5.2.0",
57
- "npm-run-all": "4.1.5",
58
- "rimraf": "2.6.3",
59
- "rollup": "2.10.7",
60
- "rollup-plugin-postcss": "3.1.1",
61
- "rollup-plugin-sourcemaps": "0.6.2",
62
- "terser": "4.0.0",
63
- "typedoc": "0.14.2",
64
- "typescript": "4.3.4"
48
+ "rimraf": "2.7.1"
65
49
  },
66
50
  "repository": {
67
51
  "type": "git",
@@ -74,5 +58,5 @@
74
58
  "url": "https://github.com/hpcc-systems/Visualization/issues"
75
59
  },
76
60
  "homepage": "https://github.com/hpcc-systems/Visualization",
77
- "gitHead": "57aaf182adc54cbf5c002b061a6669db7e98a981"
61
+ "gitHead": "bc245d3dccc358e21bc1b2103f6d88bb75b9f999"
78
62
  }
@@ -1,3 +1,3 @@
1
- export const PKG_NAME = "@hpcc-js/dataflow";
2
- export const PKG_VERSION = "7.0.0";
3
- export const BUILD_VERSION = "2.88.0";
1
+ export const PKG_NAME = "@hpcc-js/dataflow";
2
+ export const PKG_VERSION = "8.1.1";
3
+ export const BUILD_VERSION = "2.102.1";
@@ -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
+ });