@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,49 +1,49 @@
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, population } from "./data";
5
- describe("chain", () => {
6
- it("generator", () => {
7
- const p = pipe(concat([3, 4, 5, 6]), concat([7, 8]));
8
- expect([...p([1, 2])]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
9
- const p2 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
10
- expect([...p2([1, 2])]).to.deep.equal([2, 4, 6, 7, 8]);
11
- const p3 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
12
- expect([...p3([1, 2])]).to.deep.equal([2, 4, 6, 8]);
13
- });
14
- it("fn", () => {
15
- expect([...pipe([1, 2])]).to.deep.equal([1, 2]);
16
- const p = pipe([1, 2], concat([3, 4, 5, 6]), concat([7, 8]));
17
- expect([...p]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
18
- const p2 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
19
- expect([...p2]).to.deep.equal([2, 4, 6, 7, 8]);
20
- const p3 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
21
- expect([...p3]).to.deep.equal([2, 4, 6, 8]);
22
- });
23
- it("activity", () => {
24
- expect([...pipe(concat([3, 4, 5, 6]), concat([7, 8]), activity(max()))([1, 2])]).to.deep.equal([8]);
25
- expect([...pipe([1, 2], concat([3, 4, 5, 6]), concat([7, -1, 8]), activity(min()))]).to.deep.equal([-1]);
26
- });
27
- it("scalar", () => {
28
- expect(pipe(concat([3, 4, 5, 6]), concat([7, 8]), scalar(max()))([1, 2])).to.equal(8);
29
- expect(pipe([1, 2], concat([3, 4, 5, 6]), concat([7, -1, 8]), scalar(min()))).to.equal(-1);
30
- });
31
- it("chain-all", () => {
32
- const s1 = count();
33
- const s2 = count();
34
- const myPipeline = pipe(map((_) => ({ id: _.email, display: `The id is: ${_}`, ageBucket: Math.round(_.age / 10) })), each(row => { }), sensor(s1), filter(_ => _.ageBucket !== 2), sensor(s2));
35
- expect([...myPipeline(generate(person, 1000))]).to.have.lengthOf(829);
36
- expect(s1.peek()).to.equal(1000);
37
- expect(s2.peek()).to.equal(829);
38
- });
39
- it("sensor", () => {
40
- const s1 = max(r => r.age);
41
- const s2 = max(r => r.age);
42
- const p1 = pipe(sensor(s1), filter(r => r.age < 30), sensor(s2));
43
- const data = [...p1(population)];
44
- expect(data.length).to.equal(286);
45
- expect(s1.peek()).to.equal(66);
46
- expect(s2.peek()).to.equal(29);
47
- });
48
- });
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, population } from "./data";
5
+ describe("chain", () => {
6
+ it("generator", () => {
7
+ const p = pipe(concat([3, 4, 5, 6]), concat([7, 8]));
8
+ expect([...p([1, 2])]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
9
+ const p2 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
10
+ expect([...p2([1, 2])]).to.deep.equal([2, 4, 6, 7, 8]);
11
+ const p3 = pipe(concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
12
+ expect([...p3([1, 2])]).to.deep.equal([2, 4, 6, 8]);
13
+ });
14
+ it("fn", () => {
15
+ expect([...pipe([1, 2])]).to.deep.equal([1, 2]);
16
+ const p = pipe([1, 2], concat([3, 4, 5, 6]), concat([7, 8]));
17
+ expect([...p]).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8]);
18
+ const p2 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]));
19
+ expect([...p2]).to.deep.equal([2, 4, 6, 7, 8]);
20
+ const p3 = pipe([1, 2], concat([3, 4, 5, 6]), filter(i => i % 2 === 0), concat([7, 8]), filter(i => i % 2 === 0));
21
+ expect([...p3]).to.deep.equal([2, 4, 6, 8]);
22
+ });
23
+ it("activity", () => {
24
+ expect([...pipe(concat([3, 4, 5, 6]), concat([7, 8]), activity(max()))([1, 2])]).to.deep.equal([8]);
25
+ expect([...pipe([1, 2], concat([3, 4, 5, 6]), concat([7, -1, 8]), activity(min()))]).to.deep.equal([-1]);
26
+ });
27
+ it("scalar", () => {
28
+ expect(pipe(concat([3, 4, 5, 6]), concat([7, 8]), scalar(max()))([1, 2])).to.equal(8);
29
+ expect(pipe([1, 2], concat([3, 4, 5, 6]), concat([7, -1, 8]), scalar(min()))).to.equal(-1);
30
+ });
31
+ it("chain-all", () => {
32
+ const s1 = count();
33
+ const s2 = count();
34
+ const myPipeline = pipe(map((_) => ({ id: _.email, display: `The id is: ${_}`, ageBucket: Math.round(_.age / 10) })), each(row => { }), sensor(s1), filter(_ => _.ageBucket !== 2), sensor(s2));
35
+ expect([...myPipeline(generate(person, 1000))]).to.have.lengthOf(829);
36
+ expect(s1.peek()).to.equal(1000);
37
+ expect(s2.peek()).to.equal(829);
38
+ });
39
+ it("sensor", () => {
40
+ const s1 = max(r => r.age);
41
+ const s2 = max(r => r.age);
42
+ const p1 = pipe(sensor(s1), filter(r => r.age < 30), sensor(s2));
43
+ const data = [...p1(population)];
44
+ expect(data.length).to.equal(286);
45
+ expect(s1.peek()).to.equal(66);
46
+ expect(s2.peek()).to.equal(29);
47
+ });
48
+ });
49
49
  //# sourceMappingURL=chain.js.map
@@ -1,17 +1,17 @@
1
- import { expect } from "chai";
2
- import { concat } from "../index";
3
- describe("concat", () => {
4
- it("generator", () => {
5
- expect([...concat([])([])]).to.deep.equal([]);
6
- expect([...concat([1, 2, 3])([])]).to.deep.equal([1, 2, 3]);
7
- expect([...concat([])([1, 2, 3])]).to.deep.equal([1, 2, 3]);
8
- expect([...concat([4, 5, 6])([1, 2, 3])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
9
- });
10
- it("scalarActivity", () => {
11
- expect([...concat([], [])]).to.deep.equal([]);
12
- expect([...concat([], [1, 2, 3])]).to.deep.equal([1, 2, 3]);
13
- expect([...concat([1, 2, 3], [])]).to.deep.equal([1, 2, 3]);
14
- expect([...concat([1, 2, 3], [4, 5, 6])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
15
- });
16
- });
1
+ import { expect } from "chai";
2
+ import { concat } from "../index";
3
+ describe("concat", () => {
4
+ it("generator", () => {
5
+ expect([...concat([])([])]).to.deep.equal([]);
6
+ expect([...concat([1, 2, 3])([])]).to.deep.equal([1, 2, 3]);
7
+ expect([...concat([])([1, 2, 3])]).to.deep.equal([1, 2, 3]);
8
+ expect([...concat([4, 5, 6])([1, 2, 3])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
9
+ });
10
+ it("scalarActivity", () => {
11
+ expect([...concat([], [])]).to.deep.equal([]);
12
+ expect([...concat([], [1, 2, 3])]).to.deep.equal([1, 2, 3]);
13
+ expect([...concat([1, 2, 3], [])]).to.deep.equal([1, 2, 3]);
14
+ expect([...concat([1, 2, 3], [4, 5, 6])]).to.deep.equal([1, 2, 3, 4, 5, 6]);
15
+ });
16
+ });
17
17
  //# sourceMappingURL=concat.js.map
@@ -1,19 +1,19 @@
1
- import { expect } from "chai";
2
- import { pipe, filter, count, scalar, sensor } from "../index";
3
- import { population } from "./data";
4
- describe("count", () => {
5
- it("Population", () => {
6
- const s1 = count();
7
- const s2 = count();
8
- const p1 = pipe(sensor(s1), filter(r => r.age > 30), sensor(s2));
9
- const data = [...p1(population)];
10
- expect(s1.peek()).to.equal(1000);
11
- expect(s2.peek()).to.equal(699);
12
- expect(data.length).to.equal(699);
13
- });
14
- it("scalarActivity", () => {
15
- const countActivity = scalar(count());
16
- expect(countActivity([5, 1, 2, -3, 4])).to.equal(5);
17
- });
18
- });
1
+ import { expect } from "chai";
2
+ import { pipe, filter, count, scalar, sensor } from "../index";
3
+ import { population } from "./data";
4
+ describe("count", () => {
5
+ it("Population", () => {
6
+ const s1 = count();
7
+ const s2 = count();
8
+ const p1 = pipe(sensor(s1), filter(r => r.age > 30), sensor(s2));
9
+ const data = [...p1(population)];
10
+ expect(s1.peek()).to.equal(1000);
11
+ expect(s2.peek()).to.equal(699);
12
+ expect(data.length).to.equal(699);
13
+ });
14
+ it("scalarActivity", () => {
15
+ const countActivity = scalar(count());
16
+ expect(countActivity([5, 1, 2, -3, 4])).to.equal(5);
17
+ });
18
+ });
19
19
  //# sourceMappingURL=count.js.map
@@ -1,56 +1,56 @@
1
- import * as faker from "faker";
2
- import { expect } from "chai";
3
- faker.seed(123);
4
- export function person() {
5
- return {
6
- "fname": faker.name.firstName(),
7
- "lname": faker.name.lastName(),
8
- "age": faker.random.number(50) + 16,
9
- "job": faker.name.jobType(),
10
- "username": faker.internet.userName(),
11
- "email": faker.internet.email(),
12
- "address": {
13
- "street": faker.address.streetName(),
14
- "suite": faker.address.secondaryAddress(),
15
- "city": faker.address.city(),
16
- "zipcode": faker.address.zipCode(),
17
- "state": faker.address.stateAbbr(),
18
- "geo": {
19
- "lat": faker.address.latitude(),
20
- "lng": faker.address.longitude()
21
- }
22
- },
23
- "phone": faker.phone.phoneNumber(),
24
- "website": faker.internet.domainName(),
25
- "company": {
26
- "name": faker.company.companyName(),
27
- "catchPhrase": faker.company.catchPhrase(),
28
- "bs": faker.company.bs()
29
- }
30
- };
31
- }
32
- export function* people(total = 1000) {
33
- for (let i = 0; i < total; ++i) {
34
- yield person();
35
- }
36
- }
37
- function personLite() {
38
- return {
39
- "fname": faker.name.firstName(),
40
- "lname": faker.name.lastName(),
41
- "zipcode": faker.address.zipCode(),
42
- "state": faker.address.stateAbbr()
43
- };
44
- }
45
- export function* peopleLite(total = 1000) {
46
- for (let i = 0; i < total; ++i) {
47
- yield personLite();
48
- }
49
- }
50
- export const population = [...people()];
51
- describe("data", () => {
52
- it("generate", () => {
53
- expect(population).to.have.lengthOf(1000);
54
- });
55
- });
1
+ import * as faker from "faker";
2
+ import { expect } from "chai";
3
+ faker.seed(123);
4
+ export function person() {
5
+ return {
6
+ "fname": faker.name.firstName(),
7
+ "lname": faker.name.lastName(),
8
+ "age": faker.random.number(50) + 16,
9
+ "job": faker.name.jobType(),
10
+ "username": faker.internet.userName(),
11
+ "email": faker.internet.email(),
12
+ "address": {
13
+ "street": faker.address.streetName(),
14
+ "suite": faker.address.secondaryAddress(),
15
+ "city": faker.address.city(),
16
+ "zipcode": faker.address.zipCode(),
17
+ "state": faker.address.stateAbbr(),
18
+ "geo": {
19
+ "lat": faker.address.latitude(),
20
+ "lng": faker.address.longitude()
21
+ }
22
+ },
23
+ "phone": faker.phone.phoneNumber(),
24
+ "website": faker.internet.domainName(),
25
+ "company": {
26
+ "name": faker.company.companyName(),
27
+ "catchPhrase": faker.company.catchPhrase(),
28
+ "bs": faker.company.bs()
29
+ }
30
+ };
31
+ }
32
+ export function* people(total = 1000) {
33
+ for (let i = 0; i < total; ++i) {
34
+ yield person();
35
+ }
36
+ }
37
+ function personLite() {
38
+ return {
39
+ "fname": faker.name.firstName(),
40
+ "lname": faker.name.lastName(),
41
+ "zipcode": faker.address.zipCode(),
42
+ "state": faker.address.stateAbbr()
43
+ };
44
+ }
45
+ export function* peopleLite(total = 1000) {
46
+ for (let i = 0; i < total; ++i) {
47
+ yield personLite();
48
+ }
49
+ }
50
+ export const population = [...people()];
51
+ describe("data", () => {
52
+ it("generate", () => {
53
+ expect(population).to.have.lengthOf(1000);
54
+ });
55
+ });
56
56
  //# sourceMappingURL=data.js.map
@@ -1,13 +1,13 @@
1
- import { expect } from "chai";
2
- import { deviation, scalar } from "../index";
3
- describe("deviation", () => {
4
- it("scalarActivity", () => {
5
- const calcDeviation = scalar(deviation());
6
- expect(calcDeviation([5, 1, 2, 3, 4])).to.equal(Math.sqrt(2.5));
7
- });
8
- it("empty array", () => {
9
- const deviationActivity = scalar(deviation());
10
- expect(deviationActivity([])).to.be.undefined;
11
- });
12
- });
1
+ import { expect } from "chai";
2
+ import { deviation, scalar } from "../index";
3
+ describe("deviation", () => {
4
+ it("scalarActivity", () => {
5
+ const calcDeviation = scalar(deviation());
6
+ expect(calcDeviation([5, 1, 2, 3, 4])).to.equal(Math.sqrt(2.5));
7
+ });
8
+ it("empty array", () => {
9
+ const deviationActivity = scalar(deviation());
10
+ expect(deviationActivity([])).to.be.undefined;
11
+ });
12
+ });
13
13
  //# sourceMappingURL=deviation.js.map
@@ -1,19 +1,19 @@
1
- import { expect } from "chai";
2
- import { distribution, scalar } from "../index";
3
- describe("distribution", () => {
4
- it("scalarActivity", () => {
5
- const calcDistribution = scalar(distribution());
6
- expect(calcDistribution([5, 1, 2, 3, 4])).to.deep.equal({
7
- min: 1,
8
- mean: 3,
9
- max: 5,
10
- deviation: Math.sqrt(2.5),
11
- variance: 2.5
12
- });
13
- });
14
- it("empty array", () => {
15
- const a1 = scalar(distribution());
16
- expect(a1([])).to.be.undefined;
17
- });
18
- });
1
+ import { expect } from "chai";
2
+ import { distribution, scalar } from "../index";
3
+ describe("distribution", () => {
4
+ it("scalarActivity", () => {
5
+ const calcDistribution = scalar(distribution());
6
+ expect(calcDistribution([5, 1, 2, 3, 4])).to.deep.equal({
7
+ min: 1,
8
+ mean: 3,
9
+ max: 5,
10
+ deviation: Math.sqrt(2.5),
11
+ variance: 2.5
12
+ });
13
+ });
14
+ it("empty array", () => {
15
+ const a1 = scalar(distribution());
16
+ expect(a1([])).to.be.undefined;
17
+ });
18
+ });
19
19
  //# sourceMappingURL=distribution.js.map
@@ -1,12 +1,12 @@
1
- import { expect } from "chai";
2
- import { each } from "../index";
3
- import { population } from "./data";
4
- describe("each", () => {
5
- it("generator", () => {
6
- [...each((row, i) => expect(row).to.equal(population[i]))(population)];
7
- });
8
- it("scalarActivity", () => {
9
- [...each(population, (row, i) => expect(row).to.equal(population[i]))];
10
- });
11
- });
1
+ import { expect } from "chai";
2
+ import { each } from "../index";
3
+ import { population } from "./data";
4
+ describe("each", () => {
5
+ it("generator", () => {
6
+ [...each((row, i) => expect(row).to.equal(population[i]))(population)];
7
+ });
8
+ it("scalarActivity", () => {
9
+ [...each(population, (row, i) => expect(row).to.equal(population[i]))];
10
+ });
11
+ });
12
12
  //# sourceMappingURL=each.js.map
@@ -1,13 +1,13 @@
1
- import { expect } from "chai";
2
- import { entries } from "../index";
3
- describe("entries", () => {
4
- it("generator", () => {
5
- expect([...entries()([])]).to.deep.equal([]);
6
- expect([...entries()(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
7
- });
8
- it("scalarActivity", () => {
9
- expect([...entries([])]).to.deep.equal([]);
10
- expect([...entries(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
11
- });
12
- });
1
+ import { expect } from "chai";
2
+ import { entries } from "../index";
3
+ describe("entries", () => {
4
+ it("generator", () => {
5
+ expect([...entries()([])]).to.deep.equal([]);
6
+ expect([...entries()(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
7
+ });
8
+ it("scalarActivity", () => {
9
+ expect([...entries([])]).to.deep.equal([]);
10
+ expect([...entries(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
11
+ });
12
+ });
13
13
  //# sourceMappingURL=entries.js.map
@@ -1,19 +1,19 @@
1
- import { expect } from "chai";
2
- import { pipe, filter, extent, scalar, sensor } from "../index";
3
- import { population } from "./data";
4
- describe("max", () => {
5
- it("Population", () => {
6
- const s1 = extent(r => r.age);
7
- const s2 = extent(r => r.age);
8
- const p1 = pipe(sensor(s1), filter(r => r.age > 30), sensor(s2));
9
- const data = [...p1(population)];
10
- expect(data.length).to.equal(699);
11
- expect(s1.peek()).to.deep.equal([16, 66]);
12
- expect(s2.peek()).to.deep.equal([31, 66]);
13
- });
14
- it("scalarActivity", () => {
15
- const extentActivity = scalar(extent());
16
- expect(extentActivity([5, 1, 2, -3, 4])).to.deep.equal([-3, 5]);
17
- });
18
- });
1
+ import { expect } from "chai";
2
+ import { pipe, filter, extent, scalar, sensor } from "../index";
3
+ import { population } from "./data";
4
+ describe("max", () => {
5
+ it("Population", () => {
6
+ const s1 = extent(r => r.age);
7
+ const s2 = extent(r => r.age);
8
+ const p1 = pipe(sensor(s1), filter(r => r.age > 30), sensor(s2));
9
+ const data = [...p1(population)];
10
+ expect(data.length).to.equal(699);
11
+ expect(s1.peek()).to.deep.equal([16, 66]);
12
+ expect(s2.peek()).to.deep.equal([31, 66]);
13
+ });
14
+ it("scalarActivity", () => {
15
+ const extentActivity = scalar(extent());
16
+ expect(extentActivity([5, 1, 2, -3, 4])).to.deep.equal([-3, 5]);
17
+ });
18
+ });
19
19
  //# sourceMappingURL=extent.js.map
@@ -1,14 +1,14 @@
1
- import { expect } from "chai";
2
- import { filter } from "../index";
3
- import { population } from "./data";
4
- const testFilter = row => row.address.state === "FL";
5
- const expected = population.filter(testFilter);
6
- describe("filter", () => {
7
- it("generator", () => {
8
- expect([...filter(testFilter)(population)]).to.deep.equal(expected);
9
- });
10
- it("scalarActivity", () => {
11
- expect([...filter(population, testFilter)]).to.deep.equal(expected);
12
- });
13
- });
1
+ import { expect } from "chai";
2
+ import { filter } from "../index";
3
+ import { population } from "./data";
4
+ const testFilter = row => row.address.state === "FL";
5
+ const expected = population.filter(testFilter);
6
+ describe("filter", () => {
7
+ it("generator", () => {
8
+ expect([...filter(testFilter)(population)]).to.deep.equal(expected);
9
+ });
10
+ it("scalarActivity", () => {
11
+ expect([...filter(population, testFilter)]).to.deep.equal(expected);
12
+ });
13
+ });
14
14
  //# sourceMappingURL=filter.js.map
@@ -1,14 +1,14 @@
1
- import { expect } from "chai";
2
- import { first } from "../index";
3
- describe("first", () => {
4
- it("generator", () => {
5
- expect([...first(2)([])]).to.deep.equal([]);
6
- expect([...first(2)(["a", "b", "c"])]).to.deep.equal(["a", "b"]);
7
- });
8
- it("scalarActivity", () => {
9
- expect([...first([], 22)]).to.deep.equal([]);
10
- expect([...first(["a", "b", "c"], 2)]).to.deep.equal(["a", "b"]);
11
- expect([...first(["a", "b", "c"], 22)]).to.deep.equal(["a", "b", "c"]);
12
- });
13
- });
1
+ import { expect } from "chai";
2
+ import { first } from "../index";
3
+ describe("first", () => {
4
+ it("generator", () => {
5
+ expect([...first(2)([])]).to.deep.equal([]);
6
+ expect([...first(2)(["a", "b", "c"])]).to.deep.equal(["a", "b"]);
7
+ });
8
+ it("scalarActivity", () => {
9
+ expect([...first([], 22)]).to.deep.equal([]);
10
+ expect([...first(["a", "b", "c"], 2)]).to.deep.equal(["a", "b"]);
11
+ expect([...first(["a", "b", "c"], 22)]).to.deep.equal(["a", "b", "c"]);
12
+ });
13
+ });
14
14
  //# sourceMappingURL=first.js.map
@@ -1,8 +1,8 @@
1
- import { expect } from "chai";
2
- import { generate } from "../index";
3
- describe("generate", () => {
4
- it("basic", () => {
5
- expect([...generate(Math.random, 22)]).to.be.lengthOf(22);
6
- });
7
- });
1
+ import { expect } from "chai";
2
+ import { generate } from "../index";
3
+ describe("generate", () => {
4
+ it("basic", () => {
5
+ expect([...generate(Math.random, 22)]).to.be.lengthOf(22);
6
+ });
7
+ });
8
8
  //# sourceMappingURL=generate.js.map
@@ -1,18 +1,18 @@
1
- import { expect } from "chai";
2
- import { group } from "../index";
3
- import { population } from "./data";
4
- describe("group", () => {
5
- it("generator", () => {
6
- const gb = [...group(row => row.address.state)(population)];
7
- expect(gb).to.have.length;
8
- expect(gb[0].key).to.exist;
9
- expect(gb[0].value).to.have.length;
10
- });
11
- it("scalarActivity", () => {
12
- const gb = [...group(population, row => row.address.state)];
13
- expect(gb).to.have.length;
14
- expect(gb[0].key).to.exist;
15
- expect(gb[0].value).to.have.length;
16
- });
17
- });
1
+ import { expect } from "chai";
2
+ import { group } from "../index";
3
+ import { population } from "./data";
4
+ describe("group", () => {
5
+ it("generator", () => {
6
+ const gb = [...group(row => row.address.state)(population)];
7
+ expect(gb).to.have.length;
8
+ expect(gb[0].key).to.exist;
9
+ expect(gb[0].value).to.have.length;
10
+ });
11
+ it("scalarActivity", () => {
12
+ const gb = [...group(population, row => row.address.state)];
13
+ expect(gb).to.have.length;
14
+ expect(gb[0].key).to.exist;
15
+ expect(gb[0].value).to.have.length;
16
+ });
17
+ });
18
18
  //# sourceMappingURL=group.js.map
@@ -1,42 +1,42 @@
1
- import { expect } from "chai";
2
- import { histogram } from "../index";
3
- import { people, population } from "./data";
4
- describe("histogram", () => {
5
- it("generator", () => {
6
- const h = [...histogram(row => row.age, { buckets: 10 })(population)];
7
- expect(h).to.have.length;
8
- expect(h.length).to.equal(10);
9
- expect(h[0].from).to.exist;
10
- expect(h[0].to).to.exist;
11
- expect(h[0].value).to.have.length;
12
- const h2 = [...histogram(row => row.age, { min: 15, range: 5 })(population)];
13
- expect(h2).to.have.length;
14
- expect(h2.length).to.equal(11);
15
- });
16
- it("generator 2", () => {
17
- const h = [...histogram(row => row.age, { buckets: 10 })(people())];
18
- expect(h).to.have.length;
19
- expect(h.length).to.equal(10);
20
- expect(h[0].from).to.exist;
21
- expect(h[0].to).to.exist;
22
- expect(h[0].value).to.have.length;
23
- const h2 = [...histogram(row => row.age, { min: 15, range: 5 })(people())];
24
- expect(h2).to.have.length;
25
- expect(h2.length).to.equal(11);
26
- });
27
- it("scalarActivity", () => {
28
- const h = [...histogram(population, row => row.age, { buckets: 10 })];
29
- expect(h).to.have.length;
30
- expect(h[0].from).to.exist;
31
- expect(h[0].to).to.exist;
32
- expect(h[0].value).to.have.length;
33
- });
34
- it("readme", () => {
35
- const data = [1, 12, 13, 13, 3, 14, 19, 6];
36
- const h = [...histogram(data, n => n, { buckets: 3 })];
37
- expect(h).to.have.length;
38
- const h2 = [...histogram(data, n => n, { min: 0, range: 5 })];
39
- expect(h2).to.have.length;
40
- });
41
- });
1
+ import { expect } from "chai";
2
+ import { histogram } from "../index";
3
+ import { people, population } from "./data";
4
+ describe("histogram", () => {
5
+ it("generator", () => {
6
+ const h = [...histogram(row => row.age, { buckets: 10 })(population)];
7
+ expect(h).to.have.length;
8
+ expect(h.length).to.equal(10);
9
+ expect(h[0].from).to.exist;
10
+ expect(h[0].to).to.exist;
11
+ expect(h[0].value).to.have.length;
12
+ const h2 = [...histogram(row => row.age, { min: 15, range: 5 })(population)];
13
+ expect(h2).to.have.length;
14
+ expect(h2.length).to.equal(11);
15
+ });
16
+ it("generator 2", () => {
17
+ const h = [...histogram(row => row.age, { buckets: 10 })(people())];
18
+ expect(h).to.have.length;
19
+ expect(h.length).to.equal(10);
20
+ expect(h[0].from).to.exist;
21
+ expect(h[0].to).to.exist;
22
+ expect(h[0].value).to.have.length;
23
+ const h2 = [...histogram(row => row.age, { min: 15, range: 5 })(people())];
24
+ expect(h2).to.have.length;
25
+ expect(h2.length).to.equal(11);
26
+ });
27
+ it("scalarActivity", () => {
28
+ const h = [...histogram(population, row => row.age, { buckets: 10 })];
29
+ expect(h).to.have.length;
30
+ expect(h[0].from).to.exist;
31
+ expect(h[0].to).to.exist;
32
+ expect(h[0].value).to.have.length;
33
+ });
34
+ it("readme", () => {
35
+ const data = [1, 12, 13, 13, 3, 14, 19, 6];
36
+ const h = [...histogram(data, n => n, { buckets: 3 })];
37
+ expect(h).to.have.length;
38
+ const h2 = [...histogram(data, n => n, { min: 0, range: 5 })];
39
+ expect(h2).to.have.length;
40
+ });
41
+ });
42
42
  //# sourceMappingURL=histogram.js.map