@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.
- package/outputs/chunk-AY3YWKOM.js +7741 -0
- package/outputs/chunk-AY3YWKOM.js.map +1 -0
- package/outputs/sources.cjs +9007 -0
- package/outputs/sources.cjs.map +1 -0
- package/outputs/sources.d.cts +4082 -0
- package/outputs/sources.d.ts +4082 -0
- package/outputs/sources.js +1370 -0
- package/outputs/sources.js.map +1 -0
- package/outputs/tests.cjs +17208 -0
- package/outputs/tests.cjs.map +1 -0
- package/outputs/tests.d.cts +3 -0
- package/outputs/tests.d.ts +3 -0
- package/outputs/tests.js +9798 -0
- package/outputs/tests.js.map +1 -0
- package/package.json +11 -2
- package/.c8rc.json +0 -12
- package/.github/workflows/publish.yml +0 -36
- package/.mocharc.json +0 -9
- package/sources/assertMessageParameters.ts +0 -22
- package/sources/asyncIterator.ts +0 -437
- package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +0 -48
- package/sources/asyncResult.ts +0 -95
- package/sources/basicDisposable.ts +0 -57
- package/sources/byteList.ts +0 -202
- package/sources/byteListStream.ts +0 -121
- package/sources/byteReadStream.ts +0 -24
- package/sources/byteWriteStream.ts +0 -16
- package/sources/bytes.ts +0 -25
- package/sources/characterList.ts +0 -195
- package/sources/characterListStream.ts +0 -151
- package/sources/characterReadStream.ts +0 -81
- package/sources/characterReadStreamIterator.ts +0 -128
- package/sources/characterWriteStream.ts +0 -45
- package/sources/commandLineParameter.ts +0 -45
- package/sources/commandLineParameters.ts +0 -21
- package/sources/comparable.ts +0 -144
- package/sources/comparer.ts +0 -133
- package/sources/comparison.ts +0 -20
- package/sources/concatenateIterable.ts +0 -119
- package/sources/concatenateIterator.ts +0 -165
- package/sources/condition.ts +0 -329
- package/sources/currentProcess.ts +0 -158
- package/sources/dateTime.ts +0 -130
- package/sources/depthFirstSearch.ts +0 -230
- package/sources/disposable.ts +0 -31
- package/sources/emptyError.ts +0 -10
- package/sources/english.ts +0 -45
- package/sources/equalFunctions.ts +0 -123
- package/sources/fetchHttpClient.ts +0 -89
- package/sources/fetchHttpResponse.ts +0 -106
- package/sources/flatMapIterable.ts +0 -104
- package/sources/flatMapIterator.ts +0 -152
- package/sources/generator.ts +0 -251
- package/sources/httpClient.ts +0 -36
- package/sources/httpHeader.ts +0 -37
- package/sources/httpHeaders.ts +0 -216
- package/sources/httpIncomingRequest.ts +0 -30
- package/sources/httpIncomingResponse.ts +0 -19
- package/sources/httpMethod.ts +0 -164
- package/sources/httpOutgoingRequest.ts +0 -119
- package/sources/httpOutgoingResponse.ts +0 -113
- package/sources/httpServer.ts +0 -34
- package/sources/inMemoryCharacterWriteStream.ts +0 -78
- package/sources/index.ts +0 -101
- package/sources/iterable.ts +0 -345
- package/sources/iterator.ts +0 -481
- package/sources/iteratorToJavascriptIteratorAdapter.ts +0 -48
- package/sources/javascript.ts +0 -59
- package/sources/javascriptArrayList.ts +0 -175
- package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +0 -124
- package/sources/javascriptIteratorToIteratorAdapter.ts +0 -133
- package/sources/javascriptMapMap.ts +0 -143
- package/sources/javascriptSetSet.ts +0 -134
- package/sources/list.ts +0 -330
- package/sources/listQueue.ts +0 -62
- package/sources/listStack.ts +0 -62
- package/sources/luxonDateTime.ts +0 -109
- package/sources/map.ts +0 -302
- package/sources/mapAsyncIterator.ts +0 -141
- package/sources/mapIterable.ts +0 -105
- package/sources/mapIterator.ts +0 -145
- package/sources/mutableCondition.ts +0 -451
- package/sources/mutableHttpHeaders.ts +0 -204
- package/sources/mutableMap.ts +0 -292
- package/sources/network.ts +0 -18
- package/sources/node.ts +0 -37
- package/sources/nodeJSCharacterWriteStream.ts +0 -42
- package/sources/nodeJSHttpIncomingRequest.ts +0 -132
- package/sources/nodeJSHttpServer.ts +0 -134
- package/sources/notFoundError.ts +0 -12
- package/sources/postCondition.ts +0 -284
- package/sources/postConditionError.ts +0 -12
- package/sources/preCondition.ts +0 -284
- package/sources/preConditionError.ts +0 -12
- package/sources/promiseAsyncResult.ts +0 -174
- package/sources/property.ts +0 -63
- package/sources/queue.ts +0 -49
- package/sources/realNetwork.ts +0 -28
- package/sources/recreationDotGovClient.ts +0 -259
- package/sources/searchControl.ts +0 -42
- package/sources/set.ts +0 -244
- package/sources/skipAsyncIterator.ts +0 -145
- package/sources/skipIterator.ts +0 -155
- package/sources/stack.ts +0 -48
- package/sources/stringComparer.ts +0 -33
- package/sources/stringIterator.ts +0 -149
- package/sources/strings.ts +0 -322
- package/sources/syncResult.ts +0 -300
- package/sources/takeAsyncIterator.ts +0 -141
- package/sources/takeIterator.ts +0 -151
- package/sources/toStringFunctions.ts +0 -185
- package/sources/types.ts +0 -371
- package/sources/whereAsyncIterator.ts +0 -143
- package/sources/whereIterable.ts +0 -108
- package/sources/whereIterator.ts +0 -157
- package/sources/wonderlandTrailClient.ts +0 -1503
- package/tests/assertTest.ts +0 -113
- package/tests/assertTestTests.ts +0 -75
- package/tests/basicTestSkip.ts +0 -51
- package/tests/byteListStreamTests.ts +0 -390
- package/tests/byteListTests.ts +0 -27
- package/tests/bytesTests.ts +0 -43
- package/tests/characterListStreamTests.ts +0 -391
- package/tests/characterListTests.ts +0 -250
- package/tests/characterWriteStreamTests.ts +0 -12
- package/tests/comparerTests.ts +0 -92
- package/tests/conditionTests.ts +0 -877
- package/tests/consoleTestRunner.ts +0 -404
- package/tests/consoleTestRunnerTests.ts +0 -651
- package/tests/dateTimeTests.ts +0 -30
- package/tests/depthFirstSearchTests.ts +0 -106
- package/tests/disposableTests.ts +0 -121
- package/tests/englishTests.ts +0 -103
- package/tests/equalFunctionsTests.ts +0 -223
- package/tests/failedTest.ts +0 -43
- package/tests/fetchHttpClientTests.ts +0 -33
- package/tests/generatorTests.ts +0 -86
- package/tests/httpClientTests.ts +0 -18
- package/tests/inMemoryCharacterWriteStreamTests.ts +0 -117
- package/tests/iterableTests.ts +0 -141
- package/tests/iteratorTests.ts +0 -1086
- package/tests/javascriptMapMapTests.ts +0 -21
- package/tests/listTests.ts +0 -338
- package/tests/mapIteratorTests.ts +0 -55
- package/tests/mapTests.ts +0 -104
- package/tests/mutableConditionTests.ts +0 -273
- package/tests/mutableMapTests.ts +0 -154
- package/tests/nodeJSHttpServerTests.ts +0 -75
- package/tests/notFoundErrorTests.ts +0 -24
- package/tests/postConditionErrorTests.ts +0 -24
- package/tests/preConditionErrorTests.ts +0 -24
- package/tests/promiseAsyncResultTests.ts +0 -688
- package/tests/propertyTests.ts +0 -63
- package/tests/queueTests.ts +0 -29
- package/tests/recreationDotGovClientTests.ts +0 -191
- package/tests/setTests.ts +0 -140
- package/tests/skippedTest.ts +0 -39
- package/tests/stackTests.ts +0 -66
- package/tests/stringComparerTests.ts +0 -60
- package/tests/stringIteratorTests.ts +0 -156
- package/tests/stringsTests.ts +0 -516
- package/tests/syncResultTests.ts +0 -1251
- package/tests/test.ts +0 -228
- package/tests/testAction.ts +0 -75
- package/tests/testActionTests.ts +0 -93
- package/tests/testFailureTests.ts +0 -12
- package/tests/testRunner.ts +0 -267
- package/tests/testRunnerTests.ts +0 -895
- package/tests/testSkip.ts +0 -34
- package/tests/tests.ts +0 -103
- package/tests/toStringFunctionsTests.ts +0 -55
- package/tests/typesTests.ts +0 -257
- package/tests/whereIteratorTests.ts +0 -77
- package/tests/wonderlandTrailClientTests.ts +0 -452
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -13
package/sources/comparer.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Comparison } from "./comparison";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A type that can be used to compare values.
|
|
5
|
-
*/
|
|
6
|
-
export abstract class Comparer<TLeft, TRight = TLeft>
|
|
7
|
-
{
|
|
8
|
-
/**
|
|
9
|
-
* Compare the two provided values.
|
|
10
|
-
* @param left The left value to compare.
|
|
11
|
-
* @param right The right value to compare.
|
|
12
|
-
*/
|
|
13
|
-
public abstract compare(left: TLeft, right: TRight): Comparison;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get whether the left value is less than the right value.
|
|
17
|
-
* @param left The left value to compare.
|
|
18
|
-
* @param right The right value to compare.
|
|
19
|
-
*/
|
|
20
|
-
public lessThan(left: TLeft, right: TRight): boolean
|
|
21
|
-
{
|
|
22
|
-
return this.compare(left, right) === Comparison.LessThan;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get whether the left value is less than or equal to the right value.
|
|
27
|
-
* @param left The left value to compare.
|
|
28
|
-
* @param right The right value to compare.
|
|
29
|
-
*/
|
|
30
|
-
public lessThanOrEqual(left: TLeft, right: TRight): boolean
|
|
31
|
-
{
|
|
32
|
-
return this.compare(left, right) !== Comparison.GreaterThan;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Get whether the left value equals the right value.
|
|
37
|
-
* @param left The left value to compare.
|
|
38
|
-
* @param right The right value to compare.
|
|
39
|
-
*/
|
|
40
|
-
public equal(left: TLeft, right: TRight): boolean
|
|
41
|
-
{
|
|
42
|
-
return this.compare(left, right) === Comparison.Equal;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Get whether the left value is greater than or equal to the right value.
|
|
47
|
-
* @param left The left value to compare.
|
|
48
|
-
* @param right The right value to compare.
|
|
49
|
-
*/
|
|
50
|
-
public greaterThanOrEqualTo(left: TLeft, right: TRight): boolean
|
|
51
|
-
{
|
|
52
|
-
return this.compare(left, right) !== Comparison.LessThan;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get whether the left value is greater than the right value.
|
|
57
|
-
* @param left The left value to compare.
|
|
58
|
-
* @param right The right value to compare.
|
|
59
|
-
*/
|
|
60
|
-
public greaterThan(left: TLeft, right: TRight): boolean
|
|
61
|
-
{
|
|
62
|
-
return this.compare(left, right) === Comparison.GreaterThan;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Attempt to compare the left and right values. The comparison will be done on whether they are
|
|
67
|
-
* the same value (left === right) or whether one is undefined or null. If they aren't the same
|
|
68
|
-
* value and neither is undefined or null, then this function can't compare them and will return
|
|
69
|
-
* undefined.
|
|
70
|
-
* @param left The left value of the comparison.
|
|
71
|
-
* @param right The right value of the comparison.
|
|
72
|
-
*/
|
|
73
|
-
public static compareSameUndefinedNull(left: unknown, right: unknown): Comparison | undefined
|
|
74
|
-
{
|
|
75
|
-
let result: Comparison | undefined = undefined;
|
|
76
|
-
if (left === right)
|
|
77
|
-
{
|
|
78
|
-
result = Comparison.Equal;
|
|
79
|
-
}
|
|
80
|
-
else if (left === undefined)
|
|
81
|
-
{
|
|
82
|
-
result = Comparison.LessThan;
|
|
83
|
-
}
|
|
84
|
-
else if (right === undefined)
|
|
85
|
-
{
|
|
86
|
-
result = Comparison.GreaterThan;
|
|
87
|
-
}
|
|
88
|
-
else if (left === null)
|
|
89
|
-
{
|
|
90
|
-
result = Comparison.LessThan;
|
|
91
|
-
}
|
|
92
|
-
else if (right === null)
|
|
93
|
-
{
|
|
94
|
-
result = Comparison.GreaterThan;
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Get whether the left and right values are equal. The comparison will be done on whether they
|
|
101
|
-
* are the same value (left === right) or whether one is undefined or null. If they aren't the
|
|
102
|
-
* same value and neither is undefined or null, then this function can't determine whether they
|
|
103
|
-
* are equal and will return undefined.
|
|
104
|
-
* @param left The left value of the comparison.
|
|
105
|
-
* @param right The right value of the comparison.
|
|
106
|
-
*/
|
|
107
|
-
public static equalSameUndefinedNull(left: unknown, right: unknown): boolean | undefined
|
|
108
|
-
{
|
|
109
|
-
let result: Comparison | undefined = Comparer.compareSameUndefinedNull(left, right);
|
|
110
|
-
return result === undefined ? undefined : result === Comparison.Equal;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
public static compareNumbers(left: number | undefined | null, right: number | undefined | null): Comparison
|
|
114
|
-
{
|
|
115
|
-
let result: Comparison | undefined = Comparer.compareSameUndefinedNull(left, right);
|
|
116
|
-
if (result === undefined)
|
|
117
|
-
{
|
|
118
|
-
if (left! < right!)
|
|
119
|
-
{
|
|
120
|
-
result = Comparison.LessThan;
|
|
121
|
-
}
|
|
122
|
-
// else if (left === right)
|
|
123
|
-
// {
|
|
124
|
-
// result = Comparison.Equal;
|
|
125
|
-
// }
|
|
126
|
-
else
|
|
127
|
-
{
|
|
128
|
-
result = Comparison.GreaterThan;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return result;
|
|
132
|
-
}
|
|
133
|
-
}
|
package/sources/comparison.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The result of comparing two values.
|
|
3
|
-
*/
|
|
4
|
-
export enum Comparison
|
|
5
|
-
{
|
|
6
|
-
/**
|
|
7
|
-
* The left value is less than the right value.
|
|
8
|
-
*/
|
|
9
|
-
LessThan,
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The two values are equal.
|
|
13
|
-
*/
|
|
14
|
-
Equal,
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The left value is greater than the right value.
|
|
18
|
-
*/
|
|
19
|
-
GreaterThan,
|
|
20
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { ConcatenateIterator } from "./concatenateIterator";
|
|
2
|
-
import { EqualFunctions } from "./equalFunctions";
|
|
3
|
-
import { Iterable } from "./iterable";
|
|
4
|
-
import { Iterator } from "./iterator";
|
|
5
|
-
import { JavascriptIterable, JavascriptIterator } from "./javascript";
|
|
6
|
-
import { List } from "./list";
|
|
7
|
-
import { PreCondition } from "./preCondition";
|
|
8
|
-
import { SyncResult } from "./syncResult";
|
|
9
|
-
import { ToStringFunctions } from "./toStringFunctions";
|
|
10
|
-
import { Type } from "./types";
|
|
11
|
-
|
|
12
|
-
export class ConcatenateIterable<T> implements Iterable<T>
|
|
13
|
-
{
|
|
14
|
-
private readonly innerIterables: Iterable<Iterable<T>>;
|
|
15
|
-
|
|
16
|
-
private constructor(innerIterables: Iterable<Iterable<T>>)
|
|
17
|
-
{
|
|
18
|
-
PreCondition.assertNotUndefinedAndNotNull(innerIterables, "innerIterables");
|
|
19
|
-
|
|
20
|
-
this.innerIterables = innerIterables;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public static create<T>(innerIterable: Iterable<T>, ...toConcatenate: JavascriptIterable<T>[]): ConcatenateIterable<T>
|
|
24
|
-
{
|
|
25
|
-
PreCondition.assertNotUndefinedAndNotNull(innerIterable, "innerIterable");
|
|
26
|
-
PreCondition.assertNotUndefinedAndNotNull(toConcatenate, "toConcatenate");
|
|
27
|
-
|
|
28
|
-
const innerIterables: List<Iterable<T>> = List.create();
|
|
29
|
-
innerIterables.add(innerIterable);
|
|
30
|
-
for (const value of toConcatenate)
|
|
31
|
-
{
|
|
32
|
-
innerIterables.add(Iterable.create(value));
|
|
33
|
-
}
|
|
34
|
-
return new ConcatenateIterable<T>(innerIterables);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public iterate(): Iterator<T>
|
|
38
|
-
{
|
|
39
|
-
return ConcatenateIterator.create<T>(...this.innerIterables);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public toArray(): SyncResult<T[]>
|
|
43
|
-
{
|
|
44
|
-
return Iterable.toArray(this);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public any(): SyncResult<boolean>
|
|
48
|
-
{
|
|
49
|
-
return Iterable.any(this);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public getCount(): SyncResult<number>
|
|
53
|
-
{
|
|
54
|
-
return SyncResult.create(() =>
|
|
55
|
-
{
|
|
56
|
-
let result: number = 0;
|
|
57
|
-
for (const innerIterable of this.innerIterables)
|
|
58
|
-
{
|
|
59
|
-
result += innerIterable.getCount().await();
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public equals(right: JavascriptIterable<T>, equalFunctions?: EqualFunctions): SyncResult<boolean>
|
|
66
|
-
{
|
|
67
|
-
return Iterable.equals(this, right, equalFunctions);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public toString(toStringFunctions?: ToStringFunctions): string
|
|
71
|
-
{
|
|
72
|
-
return Iterable.toString(this, toStringFunctions);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public concatenate(...toConcatenate: JavascriptIterable<T>[]): Iterable<T>
|
|
76
|
-
{
|
|
77
|
-
return Iterable.concatenate(this, ...toConcatenate);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public map<TOutput>(mapping: (value: T) => TOutput | SyncResult<TOutput>): Iterable<TOutput>
|
|
81
|
-
{
|
|
82
|
-
return Iterable.map(this, mapping);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public flatMap<TOutput>(mapping: (value: T) => JavascriptIterable<TOutput>): Iterable<TOutput>
|
|
86
|
-
{
|
|
87
|
-
return Iterable.flatMap(this, mapping);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public where(condition: (value: T) => (boolean | SyncResult<boolean>)): Iterable<T>
|
|
91
|
-
{
|
|
92
|
-
return Iterable.where(this, condition);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public instanceOf<TOutput extends T>(typeOrTypeCheck: Type<TOutput> | ((value: T) => value is TOutput)): Iterable<TOutput>
|
|
96
|
-
{
|
|
97
|
-
return Iterable.instanceOf(this, typeOrTypeCheck);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public first(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
101
|
-
{
|
|
102
|
-
return Iterable.first(this, condition);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
public last(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
106
|
-
{
|
|
107
|
-
return Iterable.last(this, condition);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public contains(value: T, equalFunctions?: EqualFunctions): SyncResult<boolean>
|
|
111
|
-
{
|
|
112
|
-
return Iterable.contains(this, value, equalFunctions);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
public [Symbol.iterator](): JavascriptIterator<T>
|
|
116
|
-
{
|
|
117
|
-
return Iterable[Symbol.iterator](this);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { Iterator } from "./iterator";
|
|
2
|
-
import { JavascriptIterable, JavascriptIterator } from "./javascript";
|
|
3
|
-
import { List } from "./list";
|
|
4
|
-
import { PreCondition } from "./preCondition";
|
|
5
|
-
import { SyncResult } from "./syncResult";
|
|
6
|
-
import { Type } from "./types";
|
|
7
|
-
|
|
8
|
-
export class ConcatenateIterator<T> implements Iterator<T>
|
|
9
|
-
{
|
|
10
|
-
private readonly innerIterators: Iterator<Iterator<T>>;
|
|
11
|
-
|
|
12
|
-
private constructor(innerIterators: Iterator<Iterator<T>>)
|
|
13
|
-
{
|
|
14
|
-
PreCondition.assertNotUndefinedAndNotNull(innerIterators, "innerIterators");
|
|
15
|
-
|
|
16
|
-
this.innerIterators = innerIterators;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public static create<T>(...toConcatenate: JavascriptIterable<T>[]): ConcatenateIterator<T>
|
|
20
|
-
{
|
|
21
|
-
PreCondition.assertNotUndefinedAndNotNull(toConcatenate, "toConcatenate");
|
|
22
|
-
|
|
23
|
-
const innerIterators: List<Iterator<T>> = List.create();
|
|
24
|
-
for (const value of toConcatenate)
|
|
25
|
-
{
|
|
26
|
-
innerIterators.add(Iterator.create(value));
|
|
27
|
-
}
|
|
28
|
-
return new ConcatenateIterator<T>(innerIterators.iterate());
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public next(): SyncResult<boolean>
|
|
32
|
-
{
|
|
33
|
-
return SyncResult.create(() =>
|
|
34
|
-
{
|
|
35
|
-
let innerIteratorAtBeginning: boolean = false;
|
|
36
|
-
if (!this.innerIterators.hasStarted())
|
|
37
|
-
{
|
|
38
|
-
this.innerIterators.next().await();
|
|
39
|
-
innerIteratorAtBeginning = true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
while (this.innerIterators.hasCurrent())
|
|
43
|
-
{
|
|
44
|
-
const innerIterator: Iterator<T> = this.innerIterators.getCurrent();
|
|
45
|
-
if (innerIteratorAtBeginning)
|
|
46
|
-
{
|
|
47
|
-
innerIterator.start().await();
|
|
48
|
-
}
|
|
49
|
-
else
|
|
50
|
-
{
|
|
51
|
-
innerIterator.next().await();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (innerIterator.hasCurrent())
|
|
55
|
-
{
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
else
|
|
59
|
-
{
|
|
60
|
-
this.innerIterators.next().await();
|
|
61
|
-
innerIteratorAtBeginning = true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return this.hasCurrent();
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public hasStarted(): boolean
|
|
70
|
-
{
|
|
71
|
-
return this.innerIterators.hasStarted();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public hasCurrent(): boolean
|
|
75
|
-
{
|
|
76
|
-
return this.innerIterators.hasCurrent();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public getCurrent(): T
|
|
80
|
-
{
|
|
81
|
-
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
82
|
-
|
|
83
|
-
return this.innerIterators.getCurrent().getCurrent();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public start(): SyncResult<this>
|
|
87
|
-
{
|
|
88
|
-
return Iterator.start<T, this>(this);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public takeCurrent(): SyncResult<T>
|
|
92
|
-
{
|
|
93
|
-
return Iterator.takeCurrent(this);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public any(): SyncResult<boolean>
|
|
97
|
-
{
|
|
98
|
-
return Iterator.any(this);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
public getCount(): SyncResult<number>
|
|
102
|
-
{
|
|
103
|
-
return Iterator.getCount(this);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public toArray(): SyncResult<T[]>
|
|
107
|
-
{
|
|
108
|
-
return Iterator.toArray(this);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public concatenate(...toConcatenate: JavascriptIterable<T>[]): Iterator<T>
|
|
112
|
-
{
|
|
113
|
-
return Iterator.concatenate(this, ...toConcatenate);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public where(condition: (value: T) => (boolean | SyncResult<boolean>)): Iterator<T>
|
|
117
|
-
{
|
|
118
|
-
return Iterator.where(this, condition);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public map<TOutput>(mapping: (value: T) => TOutput | SyncResult<TOutput>): Iterator<TOutput>
|
|
122
|
-
{
|
|
123
|
-
return Iterator.map(this, mapping);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public flatMap<TOutput>(mapping: (value: T) => JavascriptIterable<TOutput>): Iterator<TOutput>
|
|
127
|
-
{
|
|
128
|
-
return Iterator.flatMap(this, mapping);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
public whereInstanceOf<U extends T>(typeCheck: (value: T) => value is U): Iterator<U>
|
|
132
|
-
{
|
|
133
|
-
return Iterator.whereInstanceOf(this, typeCheck);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
public whereInstanceOfType<U extends T>(type: Type<U>): Iterator<U>
|
|
137
|
-
{
|
|
138
|
-
return Iterator.whereInstanceOfType(this, type);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public first(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
142
|
-
{
|
|
143
|
-
return Iterator.first(this, condition);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public last(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
147
|
-
{
|
|
148
|
-
return Iterator.last(this, condition);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public take(maximumToTake: number): Iterator<T>
|
|
152
|
-
{
|
|
153
|
-
return Iterator.take(this, maximumToTake);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
public skip(maximumToSkip: number): Iterator<T>
|
|
157
|
-
{
|
|
158
|
-
return Iterator.skip(this, maximumToSkip);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
public [Symbol.iterator](): JavascriptIterator<T>
|
|
162
|
-
{
|
|
163
|
-
return Iterator[Symbol.iterator](this);
|
|
164
|
-
}
|
|
165
|
-
}
|