@everyonesoftware/common 3.0.0 → 5.0.0

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 (176) hide show
  1. package/outputs/chunk-AY3YWKOM.js +7741 -0
  2. package/outputs/chunk-AY3YWKOM.js.map +1 -0
  3. package/outputs/sources.cjs +9007 -0
  4. package/outputs/sources.cjs.map +1 -0
  5. package/outputs/sources.d.cts +4082 -0
  6. package/outputs/sources.d.ts +4082 -0
  7. package/outputs/sources.js +1370 -0
  8. package/outputs/sources.js.map +1 -0
  9. package/outputs/tests.cjs +17208 -0
  10. package/outputs/tests.cjs.map +1 -0
  11. package/outputs/tests.d.cts +3 -0
  12. package/outputs/tests.d.ts +3 -0
  13. package/outputs/tests.js +9798 -0
  14. package/outputs/tests.js.map +1 -0
  15. package/package.json +6 -1
  16. package/.c8rc.json +0 -12
  17. package/.github/workflows/publish.yml +0 -54
  18. package/.mocharc.json +0 -9
  19. package/sources/assertMessageParameters.ts +0 -22
  20. package/sources/asyncIterator.ts +0 -437
  21. package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +0 -48
  22. package/sources/asyncResult.ts +0 -95
  23. package/sources/basicDisposable.ts +0 -57
  24. package/sources/byteList.ts +0 -202
  25. package/sources/byteListStream.ts +0 -121
  26. package/sources/byteReadStream.ts +0 -24
  27. package/sources/byteWriteStream.ts +0 -16
  28. package/sources/bytes.ts +0 -25
  29. package/sources/characterList.ts +0 -195
  30. package/sources/characterListStream.ts +0 -151
  31. package/sources/characterReadStream.ts +0 -81
  32. package/sources/characterReadStreamIterator.ts +0 -128
  33. package/sources/characterWriteStream.ts +0 -45
  34. package/sources/commandLineParameter.ts +0 -45
  35. package/sources/commandLineParameters.ts +0 -21
  36. package/sources/comparable.ts +0 -144
  37. package/sources/comparer.ts +0 -133
  38. package/sources/comparison.ts +0 -20
  39. package/sources/concatenateIterable.ts +0 -119
  40. package/sources/concatenateIterator.ts +0 -165
  41. package/sources/condition.ts +0 -329
  42. package/sources/currentProcess.ts +0 -158
  43. package/sources/dateTime.ts +0 -130
  44. package/sources/depthFirstSearch.ts +0 -230
  45. package/sources/disposable.ts +0 -31
  46. package/sources/emptyError.ts +0 -10
  47. package/sources/english.ts +0 -45
  48. package/sources/equalFunctions.ts +0 -123
  49. package/sources/fetchHttpClient.ts +0 -89
  50. package/sources/fetchHttpResponse.ts +0 -106
  51. package/sources/flatMapIterable.ts +0 -104
  52. package/sources/flatMapIterator.ts +0 -152
  53. package/sources/generator.ts +0 -251
  54. package/sources/httpClient.ts +0 -36
  55. package/sources/httpHeader.ts +0 -37
  56. package/sources/httpHeaders.ts +0 -216
  57. package/sources/httpIncomingRequest.ts +0 -30
  58. package/sources/httpIncomingResponse.ts +0 -19
  59. package/sources/httpMethod.ts +0 -164
  60. package/sources/httpOutgoingRequest.ts +0 -119
  61. package/sources/httpOutgoingResponse.ts +0 -113
  62. package/sources/httpServer.ts +0 -34
  63. package/sources/inMemoryCharacterWriteStream.ts +0 -78
  64. package/sources/index.ts +0 -101
  65. package/sources/iterable.ts +0 -345
  66. package/sources/iterator.ts +0 -481
  67. package/sources/iteratorToJavascriptIteratorAdapter.ts +0 -48
  68. package/sources/javascript.ts +0 -59
  69. package/sources/javascriptArrayList.ts +0 -175
  70. package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +0 -124
  71. package/sources/javascriptIteratorToIteratorAdapter.ts +0 -133
  72. package/sources/javascriptMapMap.ts +0 -143
  73. package/sources/javascriptSetSet.ts +0 -134
  74. package/sources/list.ts +0 -330
  75. package/sources/listQueue.ts +0 -62
  76. package/sources/listStack.ts +0 -62
  77. package/sources/luxonDateTime.ts +0 -109
  78. package/sources/map.ts +0 -302
  79. package/sources/mapAsyncIterator.ts +0 -141
  80. package/sources/mapIterable.ts +0 -105
  81. package/sources/mapIterator.ts +0 -145
  82. package/sources/mutableCondition.ts +0 -451
  83. package/sources/mutableHttpHeaders.ts +0 -204
  84. package/sources/mutableMap.ts +0 -292
  85. package/sources/network.ts +0 -18
  86. package/sources/node.ts +0 -37
  87. package/sources/nodeJSCharacterWriteStream.ts +0 -42
  88. package/sources/nodeJSHttpIncomingRequest.ts +0 -132
  89. package/sources/nodeJSHttpServer.ts +0 -134
  90. package/sources/notFoundError.ts +0 -12
  91. package/sources/postCondition.ts +0 -284
  92. package/sources/postConditionError.ts +0 -12
  93. package/sources/preCondition.ts +0 -284
  94. package/sources/preConditionError.ts +0 -12
  95. package/sources/promiseAsyncResult.ts +0 -174
  96. package/sources/property.ts +0 -63
  97. package/sources/queue.ts +0 -49
  98. package/sources/realNetwork.ts +0 -28
  99. package/sources/recreationDotGovClient.ts +0 -259
  100. package/sources/searchControl.ts +0 -42
  101. package/sources/set.ts +0 -244
  102. package/sources/skipAsyncIterator.ts +0 -145
  103. package/sources/skipIterator.ts +0 -155
  104. package/sources/stack.ts +0 -48
  105. package/sources/stringComparer.ts +0 -33
  106. package/sources/stringIterator.ts +0 -149
  107. package/sources/strings.ts +0 -322
  108. package/sources/syncResult.ts +0 -300
  109. package/sources/takeAsyncIterator.ts +0 -141
  110. package/sources/takeIterator.ts +0 -151
  111. package/sources/toStringFunctions.ts +0 -185
  112. package/sources/types.ts +0 -371
  113. package/sources/whereAsyncIterator.ts +0 -143
  114. package/sources/whereIterable.ts +0 -108
  115. package/sources/whereIterator.ts +0 -157
  116. package/sources/wonderlandTrailClient.ts +0 -1503
  117. package/tests/assertTest.ts +0 -113
  118. package/tests/assertTestTests.ts +0 -75
  119. package/tests/basicTestSkip.ts +0 -51
  120. package/tests/byteListStreamTests.ts +0 -390
  121. package/tests/byteListTests.ts +0 -27
  122. package/tests/bytesTests.ts +0 -43
  123. package/tests/characterListStreamTests.ts +0 -391
  124. package/tests/characterListTests.ts +0 -250
  125. package/tests/characterWriteStreamTests.ts +0 -12
  126. package/tests/comparerTests.ts +0 -92
  127. package/tests/conditionTests.ts +0 -877
  128. package/tests/consoleTestRunner.ts +0 -404
  129. package/tests/consoleTestRunnerTests.ts +0 -651
  130. package/tests/dateTimeTests.ts +0 -30
  131. package/tests/depthFirstSearchTests.ts +0 -106
  132. package/tests/disposableTests.ts +0 -121
  133. package/tests/englishTests.ts +0 -103
  134. package/tests/equalFunctionsTests.ts +0 -223
  135. package/tests/failedTest.ts +0 -43
  136. package/tests/fetchHttpClientTests.ts +0 -33
  137. package/tests/generatorTests.ts +0 -86
  138. package/tests/httpClientTests.ts +0 -18
  139. package/tests/inMemoryCharacterWriteStreamTests.ts +0 -117
  140. package/tests/iterableTests.ts +0 -141
  141. package/tests/iteratorTests.ts +0 -1086
  142. package/tests/javascriptMapMapTests.ts +0 -21
  143. package/tests/listTests.ts +0 -338
  144. package/tests/mapIteratorTests.ts +0 -55
  145. package/tests/mapTests.ts +0 -104
  146. package/tests/mutableConditionTests.ts +0 -273
  147. package/tests/mutableMapTests.ts +0 -154
  148. package/tests/nodeJSHttpServerTests.ts +0 -75
  149. package/tests/notFoundErrorTests.ts +0 -24
  150. package/tests/postConditionErrorTests.ts +0 -24
  151. package/tests/preConditionErrorTests.ts +0 -24
  152. package/tests/promiseAsyncResultTests.ts +0 -688
  153. package/tests/propertyTests.ts +0 -63
  154. package/tests/queueTests.ts +0 -29
  155. package/tests/recreationDotGovClientTests.ts +0 -191
  156. package/tests/setTests.ts +0 -140
  157. package/tests/skippedTest.ts +0 -39
  158. package/tests/stackTests.ts +0 -66
  159. package/tests/stringComparerTests.ts +0 -60
  160. package/tests/stringIteratorTests.ts +0 -156
  161. package/tests/stringsTests.ts +0 -516
  162. package/tests/syncResultTests.ts +0 -1251
  163. package/tests/test.ts +0 -228
  164. package/tests/testAction.ts +0 -75
  165. package/tests/testActionTests.ts +0 -93
  166. package/tests/testFailureTests.ts +0 -12
  167. package/tests/testRunner.ts +0 -267
  168. package/tests/testRunnerTests.ts +0 -895
  169. package/tests/testSkip.ts +0 -34
  170. package/tests/tests.ts +0 -103
  171. package/tests/toStringFunctionsTests.ts +0 -55
  172. package/tests/typesTests.ts +0 -257
  173. package/tests/whereIteratorTests.ts +0 -77
  174. package/tests/wonderlandTrailClientTests.ts +0 -452
  175. package/tsconfig.json +0 -20
  176. package/tsup.config.ts +0 -13
@@ -1,86 +0,0 @@
1
- import { Generator } from "../sources/generator";
2
- import { PreConditionError } from "../sources/preConditionError";
3
- import { Test } from "./test";
4
- import { TestRunner } from "./testRunner";
5
- import { iteratorTests } from "./iteratorTests";
6
-
7
- export function test(runner: TestRunner): void
8
- {
9
- runner.testFile("generator.ts", () =>
10
- {
11
- runner.testType("Generator<T>", () =>
12
- {
13
- iteratorTests(runner, () => Generator.create(() => {}));
14
-
15
- runner.testFunction("create()", () =>
16
- {
17
- runner.test("with undefined", (test: Test) =>
18
- {
19
- test.assertThrows(() => Generator.create(undefined!), new PreConditionError(
20
- "Expression: generatorAction",
21
- "Expected: not undefined and not null",
22
- "Actual: undefined",
23
- ));
24
- });
25
-
26
- runner.test("with null", (test: Test) =>
27
- {
28
- test.assertThrows(() => Generator.create(null!), new PreConditionError(
29
- "Expression: generatorAction",
30
- "Expected: not undefined and not null",
31
- "Actual: null",
32
- ));
33
- });
34
-
35
- runner.test("with function that doesn't add any return values or return a value", (test: Test) =>
36
- {
37
- const generator: Generator<void> = Generator.create(() => {});
38
- test.assertNotUndefinedAndNotNull(generator);
39
- test.assertEqual([], generator.toArray().await());
40
- });
41
-
42
- runner.test("with function that returns a constant value", (test: Test) =>
43
- {
44
- const generator: Generator<number> = Generator.create(() => 20);
45
- test.assertNotUndefinedAndNotNull(generator);
46
- test.assertEqual([20, 20, 20, 20], generator.take(4).toArray().await());
47
- });
48
-
49
- runner.test("with function that returns an incrementing value", (test: Test) =>
50
- {
51
- let value: number = 20;
52
- const generator: Generator<number> = Generator.create(() => value++);
53
- test.assertNotUndefinedAndNotNull(generator);
54
- test.assertEqual([20, 21, 22, 23, 24], generator.take(5).toArray().await());
55
- });
56
-
57
- runner.test("with function that always adds a return value", (test: Test) =>
58
- {
59
- const generator: Generator<number> = Generator.create(control => control.addValue(20));
60
- test.assertNotUndefinedAndNotNull(generator);
61
- test.assertEqual([20, 20, 20, 20], generator.take(4).toArray().await());
62
- });
63
-
64
- runner.test("with function that always adds multiple return values", (test: Test) =>
65
- {
66
- const generator: Generator<number> = Generator.create(control => { control.addValues([20, 21, 22]); });
67
- test.assertNotUndefinedAndNotNull(generator);
68
- test.assertEqual([20, 21, 22, 20, 21], generator.take(5).toArray().await());
69
- });
70
-
71
- runner.test("with function that always adds a return value and returns a value", (test: Test) =>
72
- {
73
- const generator: Generator<number> = Generator.create(control =>
74
- {
75
- control.addValue(20);
76
- test.assertTrue(control.hasCurrent());
77
- test.assertEqual(20, control.getCurrent());
78
- return 21;
79
- });
80
- test.assertNotUndefinedAndNotNull(generator);
81
- test.assertEqual([20, 21, 20, 21, 20], generator.take(5).toArray().await());
82
- });
83
- });
84
- });
85
- });
86
- }
@@ -1,18 +0,0 @@
1
- import { HttpClient } from "../sources/httpClient";
2
- import { Test } from "./test";
3
- import { TestRunner } from "./testRunner";
4
-
5
- export function test(runner: TestRunner): void
6
- {
7
- runner.testFile("httpClient.ts", () =>
8
- {
9
- runner.testType("HttpClient", () =>
10
- {
11
- runner.test("create()", (test: Test) =>
12
- {
13
- const client: HttpClient = HttpClient.create();
14
- test.assertNotUndefinedAndNotNull(client);
15
- });
16
- });
17
- });
18
- }
@@ -1,117 +0,0 @@
1
- import { InMemoryCharacterWriteStream } from "../sources/inMemoryCharacterWriteStream";
2
- import { SyncResult } from "../sources/syncResult";
3
- import { isUndefined } from "../sources/types";
4
- import * as characterWriteStreamTests from "./characterWriteStreamTests";
5
- import { Test } from "./test";
6
- import { TestRunner } from "./testRunner";
7
-
8
- export function test(runner: TestRunner): void
9
- {
10
- runner.testFile("inMemoryCharacterWriteStream.ts", () =>
11
- {
12
- runner.testType("InMemoryCharacterWriteStream", () =>
13
- {
14
- characterWriteStreamTests.test(runner, InMemoryCharacterWriteStream.create);
15
-
16
- runner.testFunction("create()", (test: Test) =>
17
- {
18
- const writeStream: InMemoryCharacterWriteStream = InMemoryCharacterWriteStream.create();
19
- test.assertNotUndefinedAndNotNull(writeStream);
20
- test.assertEqual("", writeStream.getWrittenText());
21
- test.assertEqual("\n", writeStream.getNewlineSequence());
22
- });
23
-
24
- runner.testFunction("clearWrittenText()", (test: Test) =>
25
- {
26
- const writeStream = InMemoryCharacterWriteStream.create();
27
-
28
- const result1: InMemoryCharacterWriteStream = writeStream.clearWrittenText();
29
- test.assertSame(writeStream, result1);
30
- test.assertEqual("", writeStream.getWrittenText());
31
-
32
- writeStream.writeString("hello world!").await();
33
- test.assertEqual("hello world!", writeStream.getWrittenText());
34
-
35
- const result2: InMemoryCharacterWriteStream = writeStream.clearWrittenText();
36
- test.assertSame(writeStream, result2);
37
- test.assertEqual("", writeStream.getWrittenText());
38
- });
39
-
40
- runner.testFunction("setNewlineSequence()", (test: Test) =>
41
- {
42
- const writeStream = InMemoryCharacterWriteStream.create();
43
-
44
- const result1: InMemoryCharacterWriteStream = writeStream.setNewlineSequence("e");
45
- test.assertSame(writeStream, result1);
46
- test.assertEqual("e", writeStream.getNewlineSequence());
47
- test.assertEqual("", writeStream.getWrittenText());
48
-
49
- const result2: SyncResult<number> = writeStream.writeString("ab");
50
- test.assertEqual("ab", writeStream.getWrittenText());
51
- for (let i = 0; i < 3; i++)
52
- {
53
- test.assertEqual(2, result2.await());
54
- test.assertEqual("ab", writeStream.getWrittenText());
55
- }
56
-
57
- const result3: SyncResult<number> = writeStream.writeLine("cd");
58
- test.assertEqual("abcde", writeStream.getWrittenText());
59
- for (let i = 0; i < 3; i++)
60
- {
61
- test.assertEqual(3, result3.await());
62
- test.assertEqual("abcde", writeStream.getWrittenText());
63
- }
64
- });
65
-
66
- runner.testFunction("writeString()", () =>
67
- {
68
- function writeStringTest(text: string): void
69
- {
70
- runner.test(`with ${runner.toString(text)}`, (test: Test) =>
71
- {
72
- const expectedWrittenText: string = text || "";
73
- const writeStream = InMemoryCharacterWriteStream.create();
74
- const result: number = writeStream.writeString(text).await();
75
- test.assertEqual(expectedWrittenText.length, result);
76
- test.assertEqual(expectedWrittenText, writeStream.getWrittenText());
77
- });
78
- }
79
-
80
- writeStringTest(undefined!);
81
- writeStringTest(null!);
82
- writeStringTest("");
83
- writeStringTest("a");
84
- writeStringTest("abc");
85
- });
86
-
87
- runner.testFunction("writeLine()", () =>
88
- {
89
- function writeLineTest(text: string, newlineSequence?: string): void
90
- {
91
- runner.test(`with ${runner.toString(text)}${isUndefined(newlineSequence) ? "" : ` and ${runner.toString(newlineSequence)}`}`, (test: Test) =>
92
- {
93
-
94
- const writeStream = InMemoryCharacterWriteStream.create();
95
- if (!isUndefined(newlineSequence))
96
- {
97
- writeStream.setNewlineSequence(newlineSequence);
98
- }
99
- const expectedWrittenText: string = (text || "") + writeStream.getNewlineSequence();
100
-
101
- const result: number = writeStream.writeLine(text).await();
102
- test.assertEqual(expectedWrittenText.length, result);
103
- test.assertEqual(expectedWrittenText, writeStream.getWrittenText());
104
- });
105
- }
106
-
107
- writeLineTest(undefined!);
108
- writeLineTest(null!);
109
- writeLineTest("");
110
- writeLineTest("a");
111
- writeLineTest("abc");
112
- writeLineTest("abc", "\r\n");
113
- writeLineTest("abc", "");
114
- });
115
- });
116
- });
117
- }
@@ -1,141 +0,0 @@
1
- import { Iterable } from "../sources/iterable";
2
- import { Test } from "./test";
3
- import { TestRunner } from "./testRunner";
4
-
5
- export function test(runner: TestRunner): void
6
- {
7
- runner.testFile("iterable.ts", () =>
8
- {
9
- runner.testType("Iterable<T>", () =>
10
- {
11
- runner.testFunction("create(JavascriptIterable<T>|undefined)", () =>
12
- {
13
- runner.test("with no arguments", async (test: Test) =>
14
- {
15
- const iterable: Iterable<number> = Iterable.create();
16
- test.assertNotUndefinedAndNotNull(iterable);
17
- test.assertEqual(await iterable.toArray(), []);
18
- test.assertEqual(await iterable.getCount(), 0);
19
- });
20
-
21
- runner.test("with empty array", async (test: Test) =>
22
- {
23
- const iterable: Iterable<number> = Iterable.create<number>([]);
24
- test.assertNotUndefinedAndNotNull(iterable);
25
- test.assertEqual(await iterable.toArray(), []);
26
- test.assertEqual(await iterable.getCount(), 0);
27
- });
28
-
29
- runner.test("with non-empty array", async (test: Test) =>
30
- {
31
- const iterable: Iterable<number> = Iterable.create([1, 2, 3]);
32
- test.assertNotUndefinedAndNotNull(iterable);
33
- test.assertEqual(await iterable.toArray(), [1, 2, 3]);
34
- test.assertEqual(await iterable.getCount(), 3);
35
- });
36
- });
37
-
38
- runner.testGroup("concatenate()", () =>
39
- {
40
- runner.testGroup("empty and", () =>
41
- {
42
- runner.test("empty", (test: Test) =>
43
- {
44
- const iterable: Iterable<number> = Iterable.create([]);
45
- const concatenateIterable: Iterable<number> = iterable.concatenate([]);
46
- test.assertEqual(concatenateIterable.toArray().await(), []);
47
- });
48
-
49
- runner.test("non-empty", (test: Test) =>
50
- {
51
- const iterable: Iterable<number> = Iterable.create([]);
52
- const concatenateIterable: Iterable<number> = iterable.concatenate([5]);
53
- test.assertEqual(concatenateIterable.toArray().await(), [5]);
54
- });
55
-
56
- runner.test("two non-emptys", (test: Test) =>
57
- {
58
- const iterable: Iterable<number> = Iterable.create([]);
59
- const concatenateIterable: Iterable<number> = iterable.concatenate([5], [6, 7]);
60
- test.assertEqual(concatenateIterable.toArray().await(), [5, 6, 7]);
61
- });
62
- });
63
-
64
- runner.testGroup("non-empty and", () =>
65
- {
66
- runner.test("empty", (test: Test) =>
67
- {
68
- const iterable: Iterable<number> = Iterable.create([1, 2]);
69
- const concatenateIterable: Iterable<number> = iterable.concatenate([]);
70
- test.assertEqual(concatenateIterable.toArray().await(), [1, 2]);
71
- });
72
-
73
- runner.test("non-empty", (test: Test) =>
74
- {
75
- const iterable: Iterable<number> = Iterable.create([3]);
76
- const concatenateIterable: Iterable<number> = iterable.concatenate([4, 5, 6]);
77
- test.assertEqual(concatenateIterable.toArray().await(), [3, 4, 5, 6]);
78
- });
79
-
80
- runner.test("two non-emptys", (test: Test) =>
81
- {
82
- const iterable: Iterable<number> = Iterable.create([7, 8, 9]);
83
- const concatenateIterable: Iterable<number> = iterable.concatenate([10, 11, 12], [13]);
84
- test.assertEqual(concatenateIterable.toArray().await(), [7, 8, 9, 10, 11, 12, 13]);
85
- });
86
- });
87
- });
88
-
89
- runner.testFunction("flatMap()", () =>
90
- {
91
- runner.test("with empty iterable", (test: Test) =>
92
- {
93
- const iterable: Iterable<number> = Iterable.create([]);
94
- const flatMapIterable: Iterable<string> = iterable.flatMap((value: number) =>
95
- {
96
- const result: string[] = [];
97
- for (let i = 0; i < value; i++)
98
- {
99
- result.push(value.toString());
100
- }
101
- return result;
102
- });
103
- test.assertEqual(flatMapIterable.toArray().await(), []);
104
- });
105
-
106
- runner.test("with non-empty iterable", (test: Test) =>
107
- {
108
- const iterable: Iterable<number> = Iterable.create([1, 2, 3]);
109
- const flatMapIterable: Iterable<string> = iterable.flatMap((value: number) =>
110
- {
111
- const result: string[] = [];
112
- for (let i = 0; i < value; i++)
113
- {
114
- result.push(value.toString());
115
- }
116
- return result;
117
- });
118
- test.assertEqual(flatMapIterable.toArray().await(), ["1", "2", "2", "3", "3", "3"]);
119
- });
120
-
121
- runner.test("with mapping that sometimes returns an empty iterable", (test: Test) =>
122
- {
123
- const iterable: Iterable<number> = Iterable.create([1, 2, 3, 4]);
124
- const flatMapIterable: Iterable<string> = iterable.flatMap((value: number) =>
125
- {
126
- const result: string[] = [];
127
- if (value % 2 === 1)
128
- {
129
- for (let i = 0; i < value; i++)
130
- {
131
- result.push(value.toString());
132
- }
133
- }
134
- return result;
135
- });
136
- test.assertEqual(flatMapIterable.toArray().await(), ["1", "3", "3", "3"]);
137
- });
138
- });
139
- });
140
- });
141
- }