@everyonesoftware/common 2.0.0 → 4.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 +11 -2
  16. package/.c8rc.json +0 -12
  17. package/.github/workflows/publish.yml +0 -36
  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
package/sources/list.ts DELETED
@@ -1,330 +0,0 @@
1
- import { EqualFunctions } from "./equalFunctions";
2
- import { Iterable } from "./iterable";
3
- import { Iterator } from "./iterator";
4
- import { JavascriptIterable, JavascriptIterator } from "./javascript";
5
- import { JavascriptArrayList } from "./javascriptArrayList";
6
- import { NotFoundError } from "./notFoundError";
7
- import { PreCondition } from "./preCondition";
8
- import { SyncResult } from "./syncResult";
9
- import { ToStringFunctions } from "./toStringFunctions";
10
- import { isUndefinedOrNull, Type } from "./types";
11
-
12
- export abstract class List<T> implements Iterable<T>
13
- {
14
- // List cannot extend Iterable because List is the default implementation of List.
15
-
16
- public static create<T>(values?: JavascriptIterable<T>): List<T>
17
- {
18
- return JavascriptArrayList.create(values);
19
- }
20
-
21
- /**
22
- * Add the provided value to the end of this {@link List}.
23
- * @param value The value to add.
24
- */
25
- public add(value: T): this
26
- {
27
- return List.add(this, value);
28
- }
29
-
30
- /**
31
- * Add the provided value to the provided {@link List}.
32
- * @param list The {@link List} to add the value to.
33
- * @param value The value to add.
34
- */
35
- public static add<T, TList extends List<T>>(list: TList, value: T): TList
36
- {
37
- PreCondition.assertNotUndefinedAndNotNull(list, "list");
38
-
39
- return list.insert(list.getCount().await(), value);
40
- }
41
-
42
- /**
43
- * Add the provided values to the end of this {@link List}.
44
- * @param values The values to add.
45
- */
46
- public addAll(values: JavascriptIterable<T>): this
47
- {
48
- return List.addAll(this, values);
49
- }
50
-
51
- /**
52
- * Add the provided values to the end of the provided {@link List}.
53
- * @param list The {@link List} to add the values to.
54
- * @param values The values to add.
55
- */
56
- public static addAll<T, TList extends List<T>>(list: TList, values: JavascriptIterable<T>): TList
57
- {
58
- PreCondition.assertNotUndefinedAndNotNull(list, "list");
59
- PreCondition.assertNotUndefinedAndNotNull(values, "values");
60
-
61
- return list.insertAll(list.getCount().await(), values);
62
- }
63
-
64
- /**
65
- * Insert the value at the index in this {@link List}.
66
- * @param index The index to insert the value at.
67
- * @param value The value to insert.
68
- */
69
- public abstract insert(index: number, value: T): this;
70
-
71
- /**
72
- * Insert the values at the index in this {@link List}.
73
- * @param index The index to insert the values at.
74
- * @param values The values to insert.
75
- */
76
- public insertAll(index: number, values: JavascriptIterable<T>): this
77
- {
78
- return List.insertAll(this, index, values);
79
- }
80
-
81
- /**
82
- * Insert the values at the index in this {@link List}.
83
- * @param list The list to insert the values into.
84
- * @param index The index to insert the values at.
85
- * @param values The values to insert.
86
- */
87
- public static insertAll<T, TList extends List<T>>(list: TList, index: number, values: JavascriptIterable<T>): TList
88
- {
89
- PreCondition.assertNotUndefinedAndNotNull(list, "list");
90
- PreCondition.assertInsertIndex(index, list.getCount().await(), "index");
91
- PreCondition.assertNotUndefinedAndNotNull(values, "values");
92
-
93
- let insertIndex: number = index;
94
- for (const value of values)
95
- {
96
- list.insert(insertIndex, value);
97
- insertIndex++;
98
- }
99
- return list;
100
- }
101
-
102
- /**
103
- * Attempt to remove the first instance of the provided value from this {@link List}. Return
104
- * whether the removed value.
105
- * @param value The value to remove.
106
- */
107
- public remove(value: T, equalFunctions?: EqualFunctions): SyncResult<T>
108
- {
109
- return List.remove(this, value, equalFunctions);
110
- }
111
-
112
- public static remove<T>(list: List<T>, value: T, equalFunctions?: EqualFunctions): SyncResult<T>
113
- {
114
- PreCondition.assertNotUndefinedAndNotNull(list, "list");
115
-
116
- if (isUndefinedOrNull(equalFunctions))
117
- {
118
- equalFunctions = EqualFunctions.create();
119
- }
120
-
121
- return SyncResult.create(() =>
122
- {
123
- let foundValue: boolean = false;
124
- let result: T | undefined;
125
-
126
- const count: number = list.getCount().await();
127
- for (let i = 0; i < count; i++)
128
- {
129
- const currentValue: T = list.get(i).await();
130
- if (equalFunctions.areEqual(value, currentValue).await())
131
- {
132
- result = currentValue;
133
- list.removeAt(i).await();
134
- foundValue = true;
135
- break;
136
- }
137
- }
138
-
139
- if (!foundValue)
140
- {
141
- const toStringFunctions: ToStringFunctions = ToStringFunctions.create();
142
- throw new NotFoundError(`Could not find the value to remove: ${toStringFunctions.toString(value)}`);
143
- }
144
-
145
- return result!;
146
- });
147
- }
148
-
149
- /**
150
- * Remove and return the value in this {@link List} at the provided index.
151
- * @param index The index to remove a value from.
152
- */
153
- public abstract removeAt(index: number): SyncResult<T>;
154
-
155
- /**
156
- * Remove the first value in this {@link List}.
157
- */
158
- public removeFirst(): SyncResult<T>
159
- {
160
- return List.removeFirst(this);
161
- }
162
-
163
- public static removeFirst<T, TList extends List<T>>(list: TList): SyncResult<T>
164
- {
165
- PreCondition.assertNotEmpty(list, "list");
166
-
167
- return list.removeAt(0);
168
- }
169
-
170
- /**
171
- * Remove the last value in this {@link List}.
172
- */
173
- public removeLast(): SyncResult<T>
174
- {
175
- return List.removeLast(this);
176
- }
177
-
178
- public static removeLast<T, TList extends List<T>>(list: TList): SyncResult<T>
179
- {
180
- PreCondition.assertNotEmpty(list, "list");
181
-
182
- return list.removeAt(list.getCount().await() - 1);
183
- }
184
-
185
- public abstract set(index: number, value: T): this;
186
-
187
- public abstract iterate(): Iterator<T>
188
-
189
- public abstract get(index: number): SyncResult<T>;
190
-
191
- public toArray(): SyncResult<T[]>
192
- {
193
- return List.toArray(this);
194
- }
195
-
196
- public static toArray<T>(list: List<T>): SyncResult<T[]>
197
- {
198
- return Iterable.toArray(list);
199
- }
200
-
201
- public any(): SyncResult<boolean>
202
- {
203
- return List.any(this);
204
- }
205
-
206
- public static any<T>(list: List<T>): SyncResult<boolean>
207
- {
208
- return Iterable.any(list);
209
- }
210
-
211
- public getCount(): SyncResult<number>
212
- {
213
- return List.getCount(this);
214
- }
215
-
216
- public static getCount<T>(list: List<T>): SyncResult<number>
217
- {
218
- return Iterable.getCount(list);
219
- }
220
-
221
- public equals(right: JavascriptIterable<T>, equalFunctions?: EqualFunctions): SyncResult<boolean>
222
- {
223
- return List.equals(this, right, equalFunctions);
224
- }
225
-
226
- public static equals<T>(left: List<T>, right: JavascriptIterable<T>, equalFunctions?: EqualFunctions): SyncResult<boolean>
227
- {
228
- return Iterable.equals(left, right, equalFunctions);
229
- }
230
-
231
- public toString(toStringFunctions?: ToStringFunctions): string
232
- {
233
- return List.toString(this, toStringFunctions);
234
- }
235
-
236
- public static toString<T>(list: List<T>, toStringFunctions?: ToStringFunctions): string
237
- {
238
- return Iterable.toString(list, toStringFunctions);
239
- }
240
-
241
- public concatenate(...toConcatenate: JavascriptIterable<T>[]): Iterable<T>
242
- {
243
- return List.concatenate(this, ...toConcatenate);
244
- }
245
-
246
- public static concatenate<T>(list: List<T>, ...toConcatenate: JavascriptIterable<T>[]): Iterable<T>
247
- {
248
- return Iterable.concatenate(list, ...toConcatenate);
249
- }
250
-
251
- public map<TOutput>(mapping: (value: T) => (TOutput | SyncResult<TOutput>)): Iterable<TOutput>
252
- {
253
- return List.map<T, TOutput>(this, mapping);
254
- }
255
-
256
- public static map<TInput, TOutput>(list: List<TInput>, mapping: (value: TInput) => (TOutput | SyncResult<TOutput>)): Iterable<TOutput>
257
- {
258
- return Iterable.map<TInput, TOutput>(list, mapping);
259
- }
260
-
261
- public flatMap<TOutput>(mapping: (value: T) => JavascriptIterable<TOutput>): Iterable<TOutput>
262
- {
263
- return List.flatMap(this, mapping);
264
- }
265
-
266
- public static flatMap<TInput, TOutput>(list: List<TInput>, mapping: (value: TInput) => JavascriptIterable<TOutput>): Iterable<TOutput>
267
- {
268
- return Iterable.flatMap<TInput, TOutput>(list, mapping);
269
- }
270
-
271
- public where(condition: (value: T) => (boolean | SyncResult<boolean>)): Iterable<T>
272
- {
273
- return List.where(this, condition);
274
- }
275
-
276
- public static where<T>(list: List<T>, condition: (value: T) => (boolean | SyncResult<boolean>)): Iterable<T>
277
- {
278
- return Iterable.where(list, condition);
279
- }
280
-
281
- public instanceOf<TOutput extends T>(typeOrTypeCheck: Type<TOutput> | ((value: T) => value is TOutput)): Iterable<TOutput>
282
- {
283
- return List.instanceOf(this, typeOrTypeCheck);
284
- }
285
-
286
- public static instanceOf<TInput, TOutput extends TInput>(list: List<TInput>, typeOrTypeCheck: Type<TOutput> | ((value: TInput) => value is TOutput)): Iterable<TOutput>
287
- {
288
- return Iterable.instanceOf(list, typeOrTypeCheck);
289
- }
290
-
291
- public first(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
292
- {
293
- return List.first(this, condition);
294
- }
295
-
296
- public static first<T>(list: List<T>, condition?: (value: T) => (boolean | SyncResult<boolean>)): SyncResult<T>
297
- {
298
- return condition ? Iterable.first(list, condition) : list.get(0);
299
- }
300
-
301
- public last(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
302
- {
303
- return List.last(this, condition);
304
- }
305
-
306
- public static last<T>(list: List<T>, condition?: (value: T) => (boolean | SyncResult<boolean>)): SyncResult<T>
307
- {
308
- return condition ? Iterable.last(list, condition) : list.get(list.getCount().await() - 1);
309
- }
310
-
311
- public [Symbol.iterator](): JavascriptIterator<T>
312
- {
313
- return List[Symbol.iterator](this);
314
- }
315
-
316
- public static [Symbol.iterator]<T>(list: List<T>): JavascriptIterator<T>
317
- {
318
- return Iterable[Symbol.iterator](list);
319
- }
320
-
321
- public contains(value: T, equalFunctions?: EqualFunctions): SyncResult<boolean>
322
- {
323
- return List.contains(this, value, equalFunctions);
324
- }
325
-
326
- public static contains<T>(list: List<T>, value: T, equalFunctions?: EqualFunctions): SyncResult<boolean>
327
- {
328
- return Iterable.contains(list, value, equalFunctions);
329
- }
330
- }
@@ -1,62 +0,0 @@
1
- import { EmptyError } from "./emptyError";
2
- import { EqualFunctions } from "./equalFunctions";
3
- import { JavascriptIterable } from "./javascript";
4
- import { List } from "./list";
5
- import { PreCondition } from "./preCondition";
6
- import { Queue } from "./queue";
7
- import { SyncResult } from "./syncResult";
8
-
9
- export class ListQueue<T> implements Queue<T>
10
- {
11
- private readonly list: List<T>;
12
-
13
- private constructor(list?: List<T>)
14
- {
15
- this.list = list ?? List.create();
16
- }
17
-
18
- public static create<T>(list?: List<T>): ListQueue<T>
19
- {
20
- return new ListQueue<T>(list);
21
- }
22
-
23
- public any(): SyncResult<boolean>
24
- {
25
- return this.list.any();
26
- }
27
-
28
- public add(value: T): SyncResult<void>
29
- {
30
- return SyncResult.create(() =>
31
- {
32
- this.list.add(value);
33
- });
34
- }
35
-
36
- public addAll(values: JavascriptIterable<T>): SyncResult<void>
37
- {
38
- PreCondition.assertNotUndefinedAndNotNull(values, "values");
39
-
40
- return SyncResult.create(() =>
41
- {
42
- this.list.addAll(values);
43
- });
44
- }
45
-
46
- public remove(): SyncResult<T>
47
- {
48
- return SyncResult.create(() =>
49
- {
50
- if (!this.any().await())
51
- {
52
- throw new EmptyError();
53
- }
54
- return this.list.removeLast().await();
55
- });
56
- }
57
-
58
- public contains(value: T, equalFunctions?: EqualFunctions): SyncResult<boolean>
59
- {
60
- return this.list.contains(value, equalFunctions);
61
- }
62
- }
@@ -1,62 +0,0 @@
1
- import { EmptyError } from "./emptyError";
2
- import { EqualFunctions } from "./equalFunctions";
3
- import { JavascriptIterable } from "./javascript";
4
- import { List } from "./list";
5
- import { PreCondition } from "./preCondition";
6
- import { Stack } from "./stack";
7
- import { SyncResult } from "./syncResult";
8
-
9
- export class ListStack<T> implements Stack<T>
10
- {
11
- private readonly list: List<T>;
12
-
13
- private constructor(list?: List<T>)
14
- {
15
- this.list = list ?? List.create();
16
- }
17
-
18
- public static create<T>(list?: List<T>): ListStack<T>
19
- {
20
- return new ListStack<T>(list);
21
- }
22
-
23
- public any(): SyncResult<boolean>
24
- {
25
- return this.list.any();
26
- }
27
-
28
- public add(value: T): SyncResult<void>
29
- {
30
- return SyncResult.create(() =>
31
- {
32
- this.list.add(value);
33
- });
34
- }
35
-
36
- public addAll(values: JavascriptIterable<T>): SyncResult<void>
37
- {
38
- PreCondition.assertNotUndefinedAndNotNull(values, "values");
39
-
40
- return SyncResult.create(() =>
41
- {
42
- this.list.addAll(values);
43
- });
44
- }
45
-
46
- public remove(): SyncResult<T>
47
- {
48
- return SyncResult.create(() =>
49
- {
50
- if (!this.any().await())
51
- {
52
- throw new EmptyError();
53
- }
54
- return this.list.removeLast().await();
55
- });
56
- }
57
-
58
- public contains(value: T, equalFunctions?: EqualFunctions): SyncResult<boolean>
59
- {
60
- return this.list.contains(value, equalFunctions);
61
- }
62
- }
@@ -1,109 +0,0 @@
1
- import * as luxon from "luxon";
2
- import { DateTime } from "./dateTime";
3
-
4
- const pctTimeZone: string = "America/Los_Angeles";
5
-
6
- export class LuxonDateTime implements DateTime
7
- {
8
- private readonly dateTime: luxon.DateTime;
9
-
10
- private constructor(dateTime: luxon.DateTime)
11
- {
12
- this.dateTime = dateTime;
13
- }
14
-
15
- private static create(dateTime: luxon.DateTime): LuxonDateTime
16
- {
17
- return new LuxonDateTime(dateTime);
18
- }
19
-
20
- public static parse(text: string): LuxonDateTime
21
- {
22
- return LuxonDateTime.create(luxon.DateTime.fromISO(text, { zone: pctTimeZone }));
23
- }
24
-
25
- public static now(): LuxonDateTime
26
- {
27
- return LuxonDateTime.create(luxon.DateTime.now().setZone(pctTimeZone));
28
- }
29
-
30
- public getYear(): number
31
- {
32
- return this.dateTime.year;
33
- }
34
-
35
- public getMonth(): number
36
- {
37
- return this.dateTime.month;
38
- }
39
-
40
- public getDay(): number
41
- {
42
- return this.dateTime.day;
43
- }
44
-
45
- public getHour(): number
46
- {
47
- return this.dateTime.hour;
48
- }
49
-
50
- public getMinute(): number
51
- {
52
- return this.dateTime.minute;
53
- }
54
-
55
- public getSecond(): number
56
- {
57
- return this.dateTime.second;
58
- }
59
-
60
- public addDays(days: number): LuxonDateTime
61
- {
62
- return LuxonDateTime.create(this.dateTime.plus({ days: days }));
63
- }
64
-
65
- public toString(): string
66
- {
67
- return this.dateTime.toISO()!;
68
- }
69
-
70
- public toDateString(): string
71
- {
72
- return this.dateTime.toISODate()!;
73
- }
74
-
75
- public compareTo(dateTime: DateTime, compareTimes: boolean): number
76
- {
77
- return DateTime.compareTo(this, dateTime, compareTimes);
78
- }
79
-
80
- public lessThan(dateTime: DateTime, compareTimes: boolean): boolean
81
- {
82
- return DateTime.lessThan(this, dateTime, compareTimes);
83
- }
84
-
85
- public lessThanOrEqualTo(dateTime: DateTime, compareTimes: boolean): boolean
86
- {
87
- return DateTime.lessThanOrEqualTo(this, dateTime, compareTimes);
88
- }
89
-
90
- public equals(dateTime: DateTime, compareTimes: boolean): boolean
91
- {
92
- return DateTime.equals(this, dateTime, compareTimes);
93
- }
94
-
95
- public greaterThanOrEqualTo(dateTime: DateTime, compareTimes: boolean): boolean
96
- {
97
- return DateTime.greaterThanOrEqualTo(this, dateTime, compareTimes);
98
- }
99
-
100
- public greaterThan(dateTime: DateTime, compareTimes: boolean): boolean
101
- {
102
- return DateTime.greaterThan(this, dateTime, compareTimes);
103
- }
104
-
105
- public get debug(): string
106
- {
107
- return DateTime.debug(this);
108
- }
109
- }