@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,149 +0,0 @@
1
- import { Iterator } from "./iterator";
2
- import { JavascriptIterable, JavascriptIterator } from "./javascript";
3
- import { PreCondition } from "./preCondition";
4
- import { SyncResult } from "./syncResult";
5
- import { Type } from "./types";
6
-
7
- /**
8
- * An {@link Iterator} that iterates over the characters in a {@link string}.
9
- */
10
- export class StringIterator implements Iterator<string>
11
- {
12
- private readonly value: string;
13
- private currentIndex: number;
14
- private started: boolean;
15
-
16
- private constructor(value: string)
17
- {
18
- this.value = value;
19
- this.currentIndex = 0;
20
- this.started = false;
21
- }
22
-
23
- public static create(value: string): StringIterator
24
- {
25
- PreCondition.assertNotUndefinedAndNotNull(value, "value");
26
-
27
- return new StringIterator(value);
28
- }
29
-
30
- public getCurrentIndex(): number
31
- {
32
- PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
33
-
34
- return this.currentIndex;
35
- }
36
-
37
- public next(): SyncResult<boolean>
38
- {
39
- return SyncResult.create(() =>
40
- {
41
- if (!this.hasStarted())
42
- {
43
- this.started = true;
44
- }
45
- else if (this.hasCurrent())
46
- {
47
- this.currentIndex++;
48
- }
49
- return this.hasCurrent();
50
- });
51
- }
52
-
53
- public hasStarted(): boolean
54
- {
55
- return this.started;
56
- }
57
-
58
- public hasCurrent(): boolean
59
- {
60
- return this.hasStarted() && this.currentIndex < this.value.length;
61
- }
62
-
63
- public getCurrent(): string
64
- {
65
- PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
66
-
67
- return this.value[this.currentIndex];
68
- }
69
-
70
- public start(): SyncResult<this>
71
- {
72
- return Iterator.start<string, this>(this);
73
- }
74
-
75
- public takeCurrent(): SyncResult<string>
76
- {
77
- return Iterator.takeCurrent(this);
78
- }
79
-
80
- public any(): SyncResult<boolean>
81
- {
82
- return Iterator.any(this);
83
- }
84
-
85
- public getCount(): SyncResult<number>
86
- {
87
- return Iterator.getCount(this);
88
- }
89
-
90
- public toArray(): SyncResult<string[]>
91
- {
92
- return Iterator.toArray(this);
93
- }
94
-
95
- public concatenate(...toConcatenate: JavascriptIterable<string>[]): Iterator<string>
96
- {
97
- return Iterator.concatenate(this, ...toConcatenate);
98
- }
99
-
100
- public map<TOutput>(mapping: (value: string) => (TOutput | SyncResult<TOutput>)): Iterator<TOutput>
101
- {
102
- return Iterator.map(this, mapping);
103
- }
104
-
105
- public flatMap<TOutput>(mapping: (value: string) => JavascriptIterable<TOutput>): Iterator<TOutput>
106
- {
107
- return Iterator.flatMap(this, mapping);
108
- }
109
-
110
- public first(): SyncResult<string>
111
- {
112
- return Iterator.first(this);
113
- }
114
-
115
- public last(): SyncResult<string>
116
- {
117
- return Iterator.last(this);
118
- }
119
-
120
- public where(condition: (value: string) => boolean): Iterator<string>
121
- {
122
- return Iterator.where(this, condition);
123
- }
124
-
125
- public whereInstanceOf<U extends string>(typeCheck: (value: string) => value is U): Iterator<U>
126
- {
127
- return Iterator.whereInstanceOf(this, typeCheck);
128
- }
129
-
130
- public whereInstanceOfType<U extends string>(type: Type<U>): Iterator<U>
131
- {
132
- return Iterator.whereInstanceOfType(this, type);
133
- }
134
-
135
- public take(maximumToTake: number): Iterator<string>
136
- {
137
- return Iterator.take(this, maximumToTake);
138
- }
139
-
140
- public skip(maximumToSkip: number): Iterator<string>
141
- {
142
- return Iterator.skip(this, maximumToSkip);
143
- }
144
-
145
- public [Symbol.iterator](): JavascriptIterator<string>
146
- {
147
- return Iterator[Symbol.iterator](this);
148
- }
149
- }
@@ -1,322 +0,0 @@
1
- import { JavascriptIterable } from "./javascript";
2
- import { PreCondition } from "./preCondition";
3
- import { isString } from "./types";
4
-
5
- export function getLength(value: string | undefined | null): number
6
- {
7
- return value !== undefined && value !== null ? value.length : 0;
8
- }
9
-
10
- export function toString(value: undefined | null | { toString(): string }): string
11
- {
12
- let result: string;
13
- if (value === undefined)
14
- {
15
- result = "undefined";
16
- }
17
- else if (value === null)
18
- {
19
- result = "null";
20
- }
21
- else
22
- {
23
- result = value.toString();
24
- }
25
-
26
- return result;
27
- }
28
-
29
- /**
30
- * Join the provided values with the provided separator in between each value.
31
- * @param separator The value to use to separate the individual values.
32
- * @param values The values to join.
33
- * @returns The joined {@link string}.
34
- */
35
- export function join(separator: string, values: JavascriptIterable<string>): string;
36
- export function join(parameters: { separator: string, values: JavascriptIterable<string> }): string;
37
- export function join(separatorOrParameters: string | { separator: string, values: JavascriptIterable<string> }, values?: JavascriptIterable<string>): string
38
- {
39
- let separator: string;
40
- if (isString(separatorOrParameters) || separatorOrParameters === undefined || separatorOrParameters === null)
41
- {
42
- separator = separatorOrParameters;
43
- }
44
- else
45
- {
46
- separator = separatorOrParameters.separator;
47
- values = separatorOrParameters.values;
48
- }
49
-
50
- PreCondition.assertNotUndefinedAndNotNull(separator, "separator");
51
- PreCondition.assertNotUndefinedAndNotNull(values, "values");
52
-
53
- return Array.from(values).join(separator);
54
- }
55
-
56
- export function escape(value: string | undefined | null, dontEscape?: string[]): string;
57
- export function escape(parameters: { value: string | undefined | null, dontEscape?: string[] }): string;
58
- export function escape(valueOrParameters: string | undefined | null | { value: string | undefined | null, dontEscape?: string[] }, dontEscape?: string[]): string
59
- {
60
- let value: string | undefined | null;
61
- if (isString(valueOrParameters) || valueOrParameters === undefined || valueOrParameters === null)
62
- {
63
- value = valueOrParameters;
64
- }
65
- else
66
- {
67
- value = valueOrParameters.value;
68
- dontEscape = valueOrParameters.dontEscape;
69
- }
70
-
71
- let result: string;
72
- if (value === undefined)
73
- {
74
- result = "undefined";
75
- }
76
- else if (value === null)
77
- {
78
- result = "null";
79
- }
80
- else
81
- {
82
- if (!dontEscape)
83
- {
84
- dontEscape = [];
85
- }
86
-
87
- result = "";
88
- for (const character of value)
89
- {
90
- if (dontEscape.includes(character))
91
- {
92
- result += character;
93
- }
94
- else
95
- {
96
- switch (character)
97
- {
98
- case "\n":
99
- result += "\\n";
100
- break;
101
-
102
- case "\r":
103
- result += "\\r";
104
- break;
105
-
106
- case "\t":
107
- result += "\\t";
108
- break;
109
-
110
- case "\'":
111
- result += "\\\'";
112
- break;
113
-
114
- case "\"":
115
- result += "\\\"";
116
- break;
117
-
118
- default:
119
- result += character;
120
- break;
121
- }
122
- }
123
- }
124
- }
125
- return result;
126
- }
127
-
128
- /**
129
- * Get a version of the provided value that is quoted with the provided quote.
130
- * @param value The value to quote.
131
- * @param quote The quotes to surround the provided value with.
132
- */
133
- export function quote(value: string | undefined | null, quote?: string): string;
134
- /**
135
- * Get a version of the provided value that is quoted with the provided quote.
136
- * @param parameters The parameters to use to invoke this function.
137
- */
138
- export function quote(parameters: { value: string | undefined | null, quote?: string }): string;
139
- export function quote(valueOrParameters: string | undefined | null | { value: string | undefined | null, quote?: string }, quote?: string): string
140
- {
141
- let value: string | undefined | null;
142
- if (isString(valueOrParameters) || valueOrParameters === undefined || valueOrParameters === null)
143
- {
144
- value = valueOrParameters;
145
- }
146
- else
147
- {
148
- value = valueOrParameters.value;
149
- quote = valueOrParameters.quote;
150
- }
151
-
152
- let result: string;
153
- if (value === undefined)
154
- {
155
- result = "undefined";
156
- }
157
- else if (value === null)
158
- {
159
- result = "null";
160
- }
161
- else
162
- {
163
- if (quote === undefined)
164
- {
165
- quote = "\"";
166
- }
167
- result = `${quote}${value}${quote}`;
168
- }
169
- return result;
170
- }
171
-
172
- /**
173
- * Get a version of the provided value where the characters are escaped and quoted.
174
- * @param value The value to escape and quote.
175
- * @param quoteString The quote to surround the value with.
176
- * @param dontEscape The characters to not escape.
177
- */
178
- export function escapeAndQuote(value: string | undefined | null, quoteString?: string, dontEscape?: string[]): string;
179
- export function escapeAndQuote(parameters: { value: string | undefined | null, quoteString?: string, dontEscape?: string[] }): string;
180
- export function escapeAndQuote(valueOrParameters: string | undefined | null | { value: string | undefined | null, quoteString?: string, dontEscape?: string[] }, quoteString?: string, dontEscape?: string[]): string
181
- {
182
- let value: string | undefined | null;
183
- if (isString(valueOrParameters) || valueOrParameters === undefined || valueOrParameters === null)
184
- {
185
- value = valueOrParameters;
186
- }
187
- else
188
- {
189
- value = valueOrParameters.value;
190
- quoteString = valueOrParameters.quoteString;
191
- dontEscape = valueOrParameters.dontEscape;
192
- }
193
-
194
- let result: string;
195
- if (value === undefined)
196
- {
197
- result = "undefined";
198
- }
199
- else if (value === null)
200
- {
201
- result = "null";
202
- }
203
- else
204
- {
205
- result = escape(value, dontEscape);
206
- result = quote(result, quoteString);
207
- }
208
- return result;
209
- }
210
-
211
- /**
212
- * Get whether the provided value only contains whitespace characters.
213
- * @param value The value to check.
214
- */
215
- export function isWhitespace(value: string): boolean
216
- {
217
- PreCondition.assertNotUndefinedAndNotNull(value, "value");
218
- PreCondition.assertSame(1, value.length, "value.length");
219
-
220
- let result: boolean = true;
221
- switch (value[0])
222
- {
223
- case " ":
224
- case "\r":
225
- case "\n":
226
- case "\t":
227
- result = true;
228
- break;
229
-
230
- default:
231
- result = false;
232
- break;
233
- }
234
- return result;
235
- }
236
-
237
- /**
238
- * Get whether the provided value only contains letters.
239
- * @param value The value to check.
240
- */
241
- export function isLetter(value: string): boolean
242
- {
243
- PreCondition.assertNotUndefinedAndNotNull(value, "value");
244
- PreCondition.assertSame(1, value.length, "value.length");
245
-
246
- const character: string = value[0];
247
- let result: boolean = false;
248
- if ("A" <= character)
249
- {
250
- result = (character <= "Z");
251
- if (!result && "a" <= character)
252
- {
253
- result = (character <= "z");
254
- }
255
- }
256
- return result;
257
- }
258
-
259
- /**
260
- * Get whether the provided value only contains letters.
261
- * @param value The value to check.
262
- */
263
- export function isLowercasedLetter(value: string): boolean
264
- {
265
- PreCondition.assertNotUndefinedAndNotNull(value, "value");
266
- PreCondition.assertSame(1, value.length, "value.length");
267
-
268
- const character: string = value[0];
269
- return ("a" <= character && character <= "z");
270
- }
271
-
272
- /**
273
- * Get whether the provided value only contains letters.
274
- * @param value The value to check.
275
- */
276
- export function isUppercasedLetter(value: string): boolean
277
- {
278
- PreCondition.assertNotUndefinedAndNotNull(value, "value");
279
- PreCondition.assertSame(1, value.length, "value.length");
280
-
281
- const character: string = value[0];
282
- return ("A" <= character && character <= "Z");
283
- }
284
-
285
- /**
286
- * Get whether the provided value only contains digits.
287
- * @param value The value to check.
288
- */
289
- export function isDigit(value: string): boolean
290
- {
291
- PreCondition.assertNotUndefinedAndNotNull(value, "value");
292
- PreCondition.assertSame(1, value.length, "value.length");
293
-
294
- const character: string = value[0];
295
- return ("0" <= character && character <= "9");
296
- }
297
-
298
- /**
299
- * Get whether the provided value only contains letters and digits.
300
- * @param value The value to check.
301
- */
302
- export function isLetterOrDigit(value: string): boolean
303
- {
304
- PreCondition.assertNotUndefinedAndNotNull(value, "value");
305
- PreCondition.assertSame(1, value.length, "value.length");
306
-
307
- const character: string = value[0];
308
- let result: boolean = false;
309
- if ("0" <= character)
310
- {
311
- result = (character <= "9");
312
- if (!result && "A" <= character)
313
- {
314
- result = (character <= "Z");
315
- if (!result && "a" <= character)
316
- {
317
- result = (character <= "z");
318
- }
319
- }
320
- }
321
- return result;
322
- }