@hpcc-js/dataflow 8.0.1 → 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 (164) 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/__tests__/chain.js +48 -48
  9. package/lib-es6/__tests__/concat.js +16 -16
  10. package/lib-es6/__tests__/count.js +18 -18
  11. package/lib-es6/__tests__/data.js +55 -55
  12. package/lib-es6/__tests__/deviation.js +12 -12
  13. package/lib-es6/__tests__/distribution.js +18 -18
  14. package/lib-es6/__tests__/each.js +11 -11
  15. package/lib-es6/__tests__/entries.js +12 -12
  16. package/lib-es6/__tests__/extent.js +18 -18
  17. package/lib-es6/__tests__/filter.js +13 -13
  18. package/lib-es6/__tests__/first.js +13 -13
  19. package/lib-es6/__tests__/generate.js +7 -7
  20. package/lib-es6/__tests__/group.js +17 -17
  21. package/lib-es6/__tests__/histogram.js +41 -41
  22. package/lib-es6/__tests__/map.js +13 -13
  23. package/lib-es6/__tests__/max.js +29 -29
  24. package/lib-es6/__tests__/mean.js +9 -9
  25. package/lib-es6/__tests__/median.js +12 -12
  26. package/lib-es6/__tests__/min.js +29 -29
  27. package/lib-es6/__tests__/quartile.js +11 -11
  28. package/lib-es6/__tests__/readme.js +95 -95
  29. package/lib-es6/__tests__/reduce.js +14 -14
  30. package/lib-es6/__tests__/skip.js +13 -13
  31. package/lib-es6/__tests__/sort.js +18 -18
  32. package/lib-es6/__tests__/variance.js +12 -12
  33. package/lib-es6/activities/activity.js +3 -3
  34. package/lib-es6/activities/concat.js +9 -9
  35. package/lib-es6/activities/each.js +13 -13
  36. package/lib-es6/activities/entries.js +12 -12
  37. package/lib-es6/activities/filter.js +14 -14
  38. package/lib-es6/activities/first.js +17 -17
  39. package/lib-es6/activities/group.js +20 -20
  40. package/lib-es6/activities/histogram.js +63 -63
  41. package/lib-es6/activities/map.js +12 -12
  42. package/lib-es6/activities/skip.js +16 -16
  43. package/lib-es6/activities/sort.js +9 -9
  44. package/lib-es6/index.js +25 -25
  45. package/lib-es6/observers/count.js +12 -12
  46. package/lib-es6/observers/deviation.js +17 -17
  47. package/lib-es6/observers/distribution.js +35 -35
  48. package/lib-es6/observers/extent.js +17 -17
  49. package/lib-es6/observers/max.js +18 -18
  50. package/lib-es6/observers/mean.js +20 -20
  51. package/lib-es6/observers/median.js +25 -25
  52. package/lib-es6/observers/min.js +18 -18
  53. package/lib-es6/observers/observer.js +34 -34
  54. package/lib-es6/observers/quartile.js +37 -37
  55. package/lib-es6/observers/reduce.js +17 -17
  56. package/lib-es6/observers/variance.js +22 -22
  57. package/lib-es6/utils/generate.js +6 -6
  58. package/lib-es6/utils/pipe.js +31 -31
  59. package/package.json +6 -24
  60. package/src/__package__.ts +3 -3
  61. package/src/__tests__/chain.ts +85 -85
  62. package/src/__tests__/concat.ts +18 -18
  63. package/src/__tests__/count.ts +25 -25
  64. package/src/__tests__/data.ts +64 -64
  65. package/src/__tests__/deviation.ts +14 -14
  66. package/src/__tests__/distribution.ts +21 -21
  67. package/src/__tests__/each.ts +13 -13
  68. package/src/__tests__/entries.ts +14 -14
  69. package/src/__tests__/extent.ts +25 -25
  70. package/src/__tests__/filter.ts +16 -16
  71. package/src/__tests__/first.ts +15 -15
  72. package/src/__tests__/generate.ts +9 -9
  73. package/src/__tests__/group.ts +19 -19
  74. package/src/__tests__/histogram.ts +47 -47
  75. package/src/__tests__/map.ts +16 -16
  76. package/src/__tests__/max.ts +42 -42
  77. package/src/__tests__/mean.ts +11 -11
  78. package/src/__tests__/median.ts +14 -14
  79. package/src/__tests__/min.ts +42 -42
  80. package/src/__tests__/quartile.ts +14 -14
  81. package/src/__tests__/readme.ts +113 -113
  82. package/src/__tests__/reduce.ts +17 -17
  83. package/src/__tests__/skip.ts +15 -15
  84. package/src/__tests__/sort.ts +21 -21
  85. package/src/__tests__/variance.ts +14 -14
  86. package/src/activities/activity.ts +8 -8
  87. package/src/activities/concat.ts +14 -14
  88. package/src/activities/each.ts +19 -19
  89. package/src/activities/entries.ts +17 -17
  90. package/src/activities/filter.ts +20 -20
  91. package/src/activities/first.ts +20 -20
  92. package/src/activities/group.ts +27 -27
  93. package/src/activities/histogram.ts +78 -78
  94. package/src/activities/map.ts +18 -18
  95. package/src/activities/skip.ts +19 -19
  96. package/src/activities/sort.ts +16 -16
  97. package/src/index.ts +25 -25
  98. package/src/observers/count.ts +15 -15
  99. package/src/observers/deviation.ts +24 -24
  100. package/src/observers/distribution.ts +51 -51
  101. package/src/observers/extent.ts +24 -24
  102. package/src/observers/max.ts +24 -24
  103. package/src/observers/mean.ts +26 -26
  104. package/src/observers/median.ts +30 -30
  105. package/src/observers/min.ts +24 -24
  106. package/src/observers/observer.ts +52 -52
  107. package/src/observers/quartile.ts +43 -43
  108. package/src/observers/reduce.ts +22 -22
  109. package/src/observers/variance.ts +29 -29
  110. package/src/utils/generate.ts +6 -6
  111. package/src/utils/pipe.ts +74 -74
  112. package/types/__package__.d.ts +3 -3
  113. package/types/__tests__/chain.d.ts +1 -1
  114. package/types/__tests__/concat.d.ts +1 -1
  115. package/types/__tests__/count.d.ts +1 -1
  116. package/types/__tests__/data.d.ts +61 -61
  117. package/types/__tests__/deviation.d.ts +1 -1
  118. package/types/__tests__/distribution.d.ts +1 -1
  119. package/types/__tests__/each.d.ts +1 -1
  120. package/types/__tests__/entries.d.ts +1 -1
  121. package/types/__tests__/extent.d.ts +1 -1
  122. package/types/__tests__/filter.d.ts +1 -1
  123. package/types/__tests__/first.d.ts +1 -1
  124. package/types/__tests__/generate.d.ts +1 -1
  125. package/types/__tests__/group.d.ts +1 -1
  126. package/types/__tests__/histogram.d.ts +1 -1
  127. package/types/__tests__/map.d.ts +1 -1
  128. package/types/__tests__/max.d.ts +1 -1
  129. package/types/__tests__/mean.d.ts +1 -1
  130. package/types/__tests__/median.d.ts +1 -1
  131. package/types/__tests__/min.d.ts +1 -1
  132. package/types/__tests__/quartile.d.ts +1 -1
  133. package/types/__tests__/readme.d.ts +1 -1
  134. package/types/__tests__/reduce.d.ts +1 -1
  135. package/types/__tests__/skip.d.ts +1 -1
  136. package/types/__tests__/sort.d.ts +1 -1
  137. package/types/__tests__/variance.d.ts +1 -1
  138. package/types/activities/activity.d.ts +5 -5
  139. package/types/activities/concat.d.ts +3 -3
  140. package/types/activities/each.d.ts +4 -4
  141. package/types/activities/entries.d.ts +3 -3
  142. package/types/activities/filter.d.ts +4 -4
  143. package/types/activities/first.d.ts +3 -3
  144. package/types/activities/group.d.ts +8 -8
  145. package/types/activities/histogram.d.ts +17 -17
  146. package/types/activities/map.d.ts +4 -4
  147. package/types/activities/skip.d.ts +3 -3
  148. package/types/activities/sort.d.ts +4 -4
  149. package/types/index.d.ts +25 -25
  150. package/types/observers/count.d.ts +2 -2
  151. package/types/observers/deviation.d.ts +4 -4
  152. package/types/observers/distribution.d.ts +12 -12
  153. package/types/observers/extent.d.ts +4 -4
  154. package/types/observers/max.d.ts +4 -4
  155. package/types/observers/mean.d.ts +4 -4
  156. package/types/observers/median.d.ts +4 -4
  157. package/types/observers/min.d.ts +4 -4
  158. package/types/observers/observer.d.ts +13 -13
  159. package/types/observers/quartile.d.ts +5 -5
  160. package/types/observers/reduce.d.ts +3 -3
  161. package/types/observers/variance.d.ts +4 -4
  162. package/types/utils/generate.d.ts +1 -1
  163. package/types/utils/pipe.d.ts +41 -41
  164. package/types-3.4/__package__.d.ts +2 -2
@@ -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
+ });
@@ -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
+ });
@@ -1,64 +1,64 @@
1
- import * as faker from "faker";
2
- import { expect } from "chai";
3
-
4
- faker.seed(123);
5
-
6
- export function person() {
7
- return {
8
- "fname": faker.name.firstName(),
9
- "lname": faker.name.lastName(),
10
- "age": faker.random.number(50) + 16,
11
- "job": faker.name.jobType(),
12
- "username": faker.internet.userName(),
13
- "email": faker.internet.email(),
14
- "address": {
15
- "street": faker.address.streetName(),
16
- "suite": faker.address.secondaryAddress(),
17
- "city": faker.address.city(),
18
- "zipcode": faker.address.zipCode(),
19
- "state": faker.address.stateAbbr(),
20
- "geo": {
21
- "lat": faker.address.latitude(),
22
- "lng": faker.address.longitude()
23
- }
24
- },
25
- "phone": faker.phone.phoneNumber(),
26
- "website": faker.internet.domainName(),
27
- "company": {
28
- "name": faker.company.companyName(),
29
- "catchPhrase": faker.company.catchPhrase(),
30
- "bs": faker.company.bs()
31
- }
32
- };
33
- }
34
- export type Person = ReturnType<typeof person>;
35
-
36
- export function* people(total = 1000) {
37
- for (let i = 0; i < total; ++i) {
38
- yield person();
39
- }
40
- }
41
-
42
- function personLite() {
43
- return {
44
- "fname": faker.name.firstName(),
45
- "lname": faker.name.lastName(),
46
- "zipcode": faker.address.zipCode(),
47
- "state": faker.address.stateAbbr()
48
- };
49
- }
50
- export type PersonLite = ReturnType<typeof person>;
51
-
52
- export function* peopleLite(total = 1000) {
53
- for (let i = 0; i < total; ++i) {
54
- yield personLite();
55
- }
56
- }
57
-
58
- export const population: Person[] = [...people()];
59
-
60
- describe("data", () => {
61
- it("generate", () => {
62
- expect(population).to.have.lengthOf(1000);
63
- });
64
- });
1
+ import * as faker from "faker";
2
+ import { expect } from "chai";
3
+
4
+ faker.seed(123);
5
+
6
+ export function person() {
7
+ return {
8
+ "fname": faker.name.firstName(),
9
+ "lname": faker.name.lastName(),
10
+ "age": faker.random.number(50) + 16,
11
+ "job": faker.name.jobType(),
12
+ "username": faker.internet.userName(),
13
+ "email": faker.internet.email(),
14
+ "address": {
15
+ "street": faker.address.streetName(),
16
+ "suite": faker.address.secondaryAddress(),
17
+ "city": faker.address.city(),
18
+ "zipcode": faker.address.zipCode(),
19
+ "state": faker.address.stateAbbr(),
20
+ "geo": {
21
+ "lat": faker.address.latitude(),
22
+ "lng": faker.address.longitude()
23
+ }
24
+ },
25
+ "phone": faker.phone.phoneNumber(),
26
+ "website": faker.internet.domainName(),
27
+ "company": {
28
+ "name": faker.company.companyName(),
29
+ "catchPhrase": faker.company.catchPhrase(),
30
+ "bs": faker.company.bs()
31
+ }
32
+ };
33
+ }
34
+ export type Person = ReturnType<typeof person>;
35
+
36
+ export function* people(total = 1000) {
37
+ for (let i = 0; i < total; ++i) {
38
+ yield person();
39
+ }
40
+ }
41
+
42
+ function personLite() {
43
+ return {
44
+ "fname": faker.name.firstName(),
45
+ "lname": faker.name.lastName(),
46
+ "zipcode": faker.address.zipCode(),
47
+ "state": faker.address.stateAbbr()
48
+ };
49
+ }
50
+ export type PersonLite = ReturnType<typeof person>;
51
+
52
+ export function* peopleLite(total = 1000) {
53
+ for (let i = 0; i < total; ++i) {
54
+ yield personLite();
55
+ }
56
+ }
57
+
58
+ export const population: Person[] = [...people()];
59
+
60
+ describe("data", () => {
61
+ it("generate", () => {
62
+ expect(population).to.have.lengthOf(1000);
63
+ });
64
+ });
@@ -1,14 +1,14 @@
1
- import { expect } from "chai";
2
- import { deviation, scalar } from "../index";
3
-
4
- describe("deviation", () => {
5
- it("scalarActivity", () => {
6
- const calcDeviation = scalar(deviation());
7
- expect(calcDeviation([5, 1, 2, 3, 4])).to.equal(Math.sqrt(2.5));
8
- });
9
-
10
- it("empty array", () => {
11
- const deviationActivity = scalar(deviation());
12
- expect(deviationActivity([])).to.be.undefined;
13
- });
14
- });
1
+ import { expect } from "chai";
2
+ import { deviation, scalar } from "../index";
3
+
4
+ describe("deviation", () => {
5
+ it("scalarActivity", () => {
6
+ const calcDeviation = scalar(deviation());
7
+ expect(calcDeviation([5, 1, 2, 3, 4])).to.equal(Math.sqrt(2.5));
8
+ });
9
+
10
+ it("empty array", () => {
11
+ const deviationActivity = scalar(deviation());
12
+ expect(deviationActivity([])).to.be.undefined;
13
+ });
14
+ });
@@ -1,21 +1,21 @@
1
- import { expect } from "chai";
2
- import { distribution, scalar } from "../index";
3
-
4
- describe("distribution", () => {
5
-
6
- it("scalarActivity", () => {
7
- const calcDistribution = scalar(distribution());
8
- expect(calcDistribution([5, 1, 2, 3, 4])).to.deep.equal({
9
- min: 1,
10
- mean: 3,
11
- max: 5,
12
- deviation: Math.sqrt(2.5),
13
- variance: 2.5
14
- });
15
- });
16
-
17
- it("empty array", () => {
18
- const a1 = scalar(distribution());
19
- expect(a1([])).to.be.undefined;
20
- });
21
- });
1
+ import { expect } from "chai";
2
+ import { distribution, scalar } from "../index";
3
+
4
+ describe("distribution", () => {
5
+
6
+ it("scalarActivity", () => {
7
+ const calcDistribution = scalar(distribution());
8
+ expect(calcDistribution([5, 1, 2, 3, 4])).to.deep.equal({
9
+ min: 1,
10
+ mean: 3,
11
+ max: 5,
12
+ deviation: Math.sqrt(2.5),
13
+ variance: 2.5
14
+ });
15
+ });
16
+
17
+ it("empty array", () => {
18
+ const a1 = scalar(distribution());
19
+ expect(a1([])).to.be.undefined;
20
+ });
21
+ });
@@ -1,13 +1,13 @@
1
- import { expect } from "chai";
2
- import { each } from "../index";
3
- import { population } from "./data";
4
-
5
- describe("each", () => {
6
- it("generator", () => {
7
- [...each((row, i) => expect(row).to.equal(population[i]))(population)];
8
- });
9
-
10
- it("scalarActivity", () => {
11
- [...each(population, (row, i) => expect(row).to.equal(population[i]))];
12
- });
13
- });
1
+ import { expect } from "chai";
2
+ import { each } from "../index";
3
+ import { population } from "./data";
4
+
5
+ describe("each", () => {
6
+ it("generator", () => {
7
+ [...each((row, i) => expect(row).to.equal(population[i]))(population)];
8
+ });
9
+
10
+ it("scalarActivity", () => {
11
+ [...each(population, (row, i) => expect(row).to.equal(population[i]))];
12
+ });
13
+ });
@@ -1,14 +1,14 @@
1
- import { expect } from "chai";
2
- import { entries } from "../index";
3
-
4
- describe("entries", () => {
5
- it("generator", () => {
6
- expect([...entries()([])]).to.deep.equal([]);
7
- expect([...entries()(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
8
- });
9
-
10
- it("scalarActivity", () => {
11
- expect([...entries([])]).to.deep.equal([]);
12
- expect([...entries(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
13
- });
14
- });
1
+ import { expect } from "chai";
2
+ import { entries } from "../index";
3
+
4
+ describe("entries", () => {
5
+ it("generator", () => {
6
+ expect([...entries()([])]).to.deep.equal([]);
7
+ expect([...entries()(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
8
+ });
9
+
10
+ it("scalarActivity", () => {
11
+ expect([...entries([])]).to.deep.equal([]);
12
+ expect([...entries(["a", "b", "c"])]).to.deep.equal([[0, "a"], [1, "b"], [2, "c"]]);
13
+ });
14
+ });
@@ -1,25 +1,25 @@
1
- import { expect } from "chai";
2
- import { pipe, filter, extent, scalar, sensor } from "../index";
3
- import { population } from "./data";
4
-
5
- describe("max", () => {
6
-
7
- it("Population", () => {
8
- const s1 = extent(r => r.age);
9
- const s2 = extent(r => r.age);
10
- const p1 = pipe(
11
- sensor(s1),
12
- filter(r => r.age > 30),
13
- sensor(s2),
14
- );
15
- const data = [...p1(population)];
16
- expect(data.length).to.equal(699);
17
- expect(s1.peek()).to.deep.equal([16, 66]);
18
- expect(s2.peek()).to.deep.equal([31, 66]);
19
- });
20
-
21
- it("scalarActivity", () => {
22
- const extentActivity = scalar(extent());
23
- expect(extentActivity([5, 1, 2, -3, 4])).to.deep.equal([-3, 5]);
24
- });
25
- });
1
+ import { expect } from "chai";
2
+ import { pipe, filter, extent, scalar, sensor } from "../index";
3
+ import { population } from "./data";
4
+
5
+ describe("max", () => {
6
+
7
+ it("Population", () => {
8
+ const s1 = extent(r => r.age);
9
+ const s2 = extent(r => r.age);
10
+ const p1 = pipe(
11
+ sensor(s1),
12
+ filter(r => r.age > 30),
13
+ sensor(s2),
14
+ );
15
+ const data = [...p1(population)];
16
+ expect(data.length).to.equal(699);
17
+ expect(s1.peek()).to.deep.equal([16, 66]);
18
+ expect(s2.peek()).to.deep.equal([31, 66]);
19
+ });
20
+
21
+ it("scalarActivity", () => {
22
+ const extentActivity = scalar(extent());
23
+ expect(extentActivity([5, 1, 2, -3, 4])).to.deep.equal([-3, 5]);
24
+ });
25
+ });
@@ -1,16 +1,16 @@
1
- import { expect } from "chai";
2
- import { filter } from "../index";
3
- import { population } from "./data";
4
-
5
- const testFilter = row => row.address.state === "FL";
6
- const expected = population.filter(testFilter);
7
-
8
- describe("filter", () => {
9
- it("generator", () => {
10
- expect([...filter(testFilter)(population)]).to.deep.equal(expected);
11
- });
12
-
13
- it("scalarActivity", () => {
14
- expect([...filter(population, testFilter)]).to.deep.equal(expected);
15
- });
16
- });
1
+ import { expect } from "chai";
2
+ import { filter } from "../index";
3
+ import { population } from "./data";
4
+
5
+ const testFilter = row => row.address.state === "FL";
6
+ const expected = population.filter(testFilter);
7
+
8
+ describe("filter", () => {
9
+ it("generator", () => {
10
+ expect([...filter(testFilter)(population)]).to.deep.equal(expected);
11
+ });
12
+
13
+ it("scalarActivity", () => {
14
+ expect([...filter(population, testFilter)]).to.deep.equal(expected);
15
+ });
16
+ });
@@ -1,15 +1,15 @@
1
- import { expect } from "chai";
2
- import { first } from "../index";
3
-
4
- describe("first", () => {
5
- it("generator", () => {
6
- expect([...first(2)([])]).to.deep.equal([]);
7
- expect([...first(2)(["a", "b", "c"])]).to.deep.equal(["a", "b"]);
8
- });
9
-
10
- it("scalarActivity", () => {
11
- expect([...first([], 22)]).to.deep.equal([]);
12
- expect([...first(["a", "b", "c"], 2)]).to.deep.equal(["a", "b"]);
13
- expect([...first(["a", "b", "c"], 22)]).to.deep.equal(["a", "b", "c"]);
14
- });
15
- });
1
+ import { expect } from "chai";
2
+ import { first } from "../index";
3
+
4
+ describe("first", () => {
5
+ it("generator", () => {
6
+ expect([...first(2)([])]).to.deep.equal([]);
7
+ expect([...first(2)(["a", "b", "c"])]).to.deep.equal(["a", "b"]);
8
+ });
9
+
10
+ it("scalarActivity", () => {
11
+ expect([...first([], 22)]).to.deep.equal([]);
12
+ expect([...first(["a", "b", "c"], 2)]).to.deep.equal(["a", "b"]);
13
+ expect([...first(["a", "b", "c"], 22)]).to.deep.equal(["a", "b", "c"]);
14
+ });
15
+ });
@@ -1,9 +1,9 @@
1
- import { expect } from "chai";
2
- import { generate } from "../index";
3
-
4
- describe("generate", () => {
5
- it("basic", () => {
6
- expect([...generate(Math.random, 22)]).to.be.lengthOf(22);
7
- });
8
-
9
- });
1
+ import { expect } from "chai";
2
+ import { generate } from "../index";
3
+
4
+ describe("generate", () => {
5
+ it("basic", () => {
6
+ expect([...generate(Math.random, 22)]).to.be.lengthOf(22);
7
+ });
8
+
9
+ });
@@ -1,19 +1,19 @@
1
- import { expect } from "chai";
2
- import { group } from "../index";
3
- import { Person, population } from "./data";
4
-
5
- describe("group", () => {
6
- it("generator", () => {
7
- const gb = [...group<Person>(row => row.address.state)(population)];
8
- expect(gb).to.have.length;
9
- expect(gb[0].key).to.exist;
10
- expect(gb[0].value).to.have.length;
11
- });
12
-
13
- it("scalarActivity", () => {
14
- const gb = [...group(population, row => row.address.state)];
15
- expect(gb).to.have.length;
16
- expect(gb[0].key).to.exist;
17
- expect(gb[0].value).to.have.length;
18
- });
19
- });
1
+ import { expect } from "chai";
2
+ import { group } from "../index";
3
+ import { Person, population } from "./data";
4
+
5
+ describe("group", () => {
6
+ it("generator", () => {
7
+ const gb = [...group<Person>(row => row.address.state)(population)];
8
+ expect(gb).to.have.length;
9
+ expect(gb[0].key).to.exist;
10
+ expect(gb[0].value).to.have.length;
11
+ });
12
+
13
+ it("scalarActivity", () => {
14
+ const gb = [...group(population, row => row.address.state)];
15
+ expect(gb).to.have.length;
16
+ expect(gb[0].key).to.exist;
17
+ expect(gb[0].value).to.have.length;
18
+ });
19
+ });
@@ -1,47 +1,47 @@
1
- import { expect } from "chai";
2
- import { histogram } from "../index";
3
- import { people, Person, population } from "./data";
4
-
5
- describe("histogram", () => {
6
- it("generator", () => {
7
- const h = [...histogram<Person>(row => row.age, { buckets: 10 })(population)];
8
- expect(h).to.have.length;
9
- expect(h.length).to.equal(10);
10
- expect(h[0].from).to.exist;
11
- expect(h[0].to).to.exist;
12
- expect(h[0].value).to.have.length;
13
-
14
- const h2 = [...histogram<Person>(row => row.age, { min: 15, range: 5 })(population)];
15
- expect(h2).to.have.length;
16
- expect(h2.length).to.equal(11);
17
- });
18
-
19
- it("generator 2", () => {
20
- const h = [...histogram<Person>(row => row.age, { buckets: 10 })(people())];
21
- expect(h).to.have.length;
22
- expect(h.length).to.equal(10);
23
- expect(h[0].from).to.exist;
24
- expect(h[0].to).to.exist;
25
- expect(h[0].value).to.have.length;
26
-
27
- const h2 = [...histogram<Person>(row => row.age, { min: 15, range: 5 })(people())];
28
- expect(h2).to.have.length;
29
- expect(h2.length).to.equal(11);
30
- });
31
-
32
- it("scalarActivity", () => {
33
- const h = [...histogram(population, row => row.age, { buckets: 10 })];
34
- expect(h).to.have.length;
35
- expect(h[0].from).to.exist;
36
- expect(h[0].to).to.exist;
37
- expect(h[0].value).to.have.length;
38
- });
39
-
40
- it("readme", () => {
41
- const data = [1, 12, 13, 13, 3, 14, 19, 6];
42
- const h = [...histogram(data, n => n, { buckets: 3 })];
43
- expect(h).to.have.length;
44
- const h2 = [...histogram(data, n => n, { min: 0, range: 5 })];
45
- expect(h2).to.have.length;
46
- });
47
- });
1
+ import { expect } from "chai";
2
+ import { histogram } from "../index";
3
+ import { people, Person, population } from "./data";
4
+
5
+ describe("histogram", () => {
6
+ it("generator", () => {
7
+ const h = [...histogram<Person>(row => row.age, { buckets: 10 })(population)];
8
+ expect(h).to.have.length;
9
+ expect(h.length).to.equal(10);
10
+ expect(h[0].from).to.exist;
11
+ expect(h[0].to).to.exist;
12
+ expect(h[0].value).to.have.length;
13
+
14
+ const h2 = [...histogram<Person>(row => row.age, { min: 15, range: 5 })(population)];
15
+ expect(h2).to.have.length;
16
+ expect(h2.length).to.equal(11);
17
+ });
18
+
19
+ it("generator 2", () => {
20
+ const h = [...histogram<Person>(row => row.age, { buckets: 10 })(people())];
21
+ expect(h).to.have.length;
22
+ expect(h.length).to.equal(10);
23
+ expect(h[0].from).to.exist;
24
+ expect(h[0].to).to.exist;
25
+ expect(h[0].value).to.have.length;
26
+
27
+ const h2 = [...histogram<Person>(row => row.age, { min: 15, range: 5 })(people())];
28
+ expect(h2).to.have.length;
29
+ expect(h2.length).to.equal(11);
30
+ });
31
+
32
+ it("scalarActivity", () => {
33
+ const h = [...histogram(population, row => row.age, { buckets: 10 })];
34
+ expect(h).to.have.length;
35
+ expect(h[0].from).to.exist;
36
+ expect(h[0].to).to.exist;
37
+ expect(h[0].value).to.have.length;
38
+ });
39
+
40
+ it("readme", () => {
41
+ const data = [1, 12, 13, 13, 3, 14, 19, 6];
42
+ const h = [...histogram(data, n => n, { buckets: 3 })];
43
+ expect(h).to.have.length;
44
+ const h2 = [...histogram(data, n => n, { min: 0, range: 5 })];
45
+ expect(h2).to.have.length;
46
+ });
47
+ });
@@ -1,16 +1,16 @@
1
- import { expect } from "chai";
2
- import { map } from "../index";
3
- import { population } from "./data";
4
-
5
- const testMap = row => ({ ...row.address });
6
- const expected = population.map(testMap);
7
-
8
- describe("map", () => {
9
- it("generator", () => {
10
- expect([...map(testMap)(population)]).to.deep.equal(expected);
11
- });
12
-
13
- it("scalarActivity", () => {
14
- expect([...map(population, testMap)]).to.deep.equal(expected);
15
- });
16
- });
1
+ import { expect } from "chai";
2
+ import { map } from "../index";
3
+ import { population } from "./data";
4
+
5
+ const testMap = row => ({ ...row.address });
6
+ const expected = population.map(testMap);
7
+
8
+ describe("map", () => {
9
+ it("generator", () => {
10
+ expect([...map(testMap)(population)]).to.deep.equal(expected);
11
+ });
12
+
13
+ it("scalarActivity", () => {
14
+ expect([...map(population, testMap)]).to.deep.equal(expected);
15
+ });
16
+ });