@everyonesoftware/common 3.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 +6 -1
- package/.c8rc.json +0 -12
- package/.github/workflows/publish.yml +0 -54
- 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
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { CharacterWriteStream } from "./characterWriteStream";
|
|
2
|
-
import { PreCondition } from "./preCondition";
|
|
3
|
-
import { getLength } from "./strings";
|
|
4
|
-
import { SyncResult } from "./syncResult";
|
|
5
|
-
|
|
6
|
-
export class InMemoryCharacterWriteStream extends CharacterWriteStream
|
|
7
|
-
{
|
|
8
|
-
private writtenText: string;
|
|
9
|
-
private newlineSequence: string;
|
|
10
|
-
|
|
11
|
-
private constructor()
|
|
12
|
-
{
|
|
13
|
-
super();
|
|
14
|
-
|
|
15
|
-
this.writtenText = "";
|
|
16
|
-
this.newlineSequence = "\n";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public static create(): InMemoryCharacterWriteStream
|
|
20
|
-
{
|
|
21
|
-
return new InMemoryCharacterWriteStream();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public getNewlineSequence(): string
|
|
25
|
-
{
|
|
26
|
-
return this.newlineSequence;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public setNewlineSequence(newlineSequence: string): this
|
|
30
|
-
{
|
|
31
|
-
PreCondition.assertNotUndefinedAndNotNull(newlineSequence, "newlineSequence");
|
|
32
|
-
|
|
33
|
-
this.newlineSequence = newlineSequence;
|
|
34
|
-
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public getWrittenText(): string
|
|
39
|
-
{
|
|
40
|
-
return this.writtenText;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public clearWrittenText(): this
|
|
44
|
-
{
|
|
45
|
-
this.writtenText = "";
|
|
46
|
-
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public writeString(text: string): SyncResult<number>
|
|
51
|
-
{
|
|
52
|
-
return SyncResult.create(() =>
|
|
53
|
-
{
|
|
54
|
-
if (text)
|
|
55
|
-
{
|
|
56
|
-
this.writtenText += text;
|
|
57
|
-
}
|
|
58
|
-
return getLength(text);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public writeLine(text?: string): SyncResult<number>
|
|
63
|
-
{
|
|
64
|
-
return SyncResult.create(() =>
|
|
65
|
-
{
|
|
66
|
-
let result: number = 0;
|
|
67
|
-
if (text)
|
|
68
|
-
{
|
|
69
|
-
result += this.writeString(text).await();
|
|
70
|
-
}
|
|
71
|
-
if (this.newlineSequence)
|
|
72
|
-
{
|
|
73
|
-
result += this.writeString(this.newlineSequence).await();
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
package/sources/index.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Automatically generated by barrelsby.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * from "./assertMessageParameters";
|
|
6
|
-
export * from "./asyncIterator";
|
|
7
|
-
export * from "./asyncIteratorToJavascriptAsyncIteratorAdapter";
|
|
8
|
-
export * from "./asyncResult";
|
|
9
|
-
export * from "./basicDisposable";
|
|
10
|
-
export * from "./byteList";
|
|
11
|
-
export * from "./byteListStream";
|
|
12
|
-
export * from "./byteReadStream";
|
|
13
|
-
export * from "./byteWriteStream";
|
|
14
|
-
export * from "./bytes";
|
|
15
|
-
export * from "./characterList";
|
|
16
|
-
export * from "./characterListStream";
|
|
17
|
-
export * from "./characterReadStream";
|
|
18
|
-
export * from "./characterReadStreamIterator";
|
|
19
|
-
export * from "./characterWriteStream";
|
|
20
|
-
export * from "./commandLineParameter";
|
|
21
|
-
export * from "./commandLineParameters";
|
|
22
|
-
export * from "./comparable";
|
|
23
|
-
export * from "./comparer";
|
|
24
|
-
export * from "./comparison";
|
|
25
|
-
export * from "./concatenateIterable";
|
|
26
|
-
export * from "./concatenateIterator";
|
|
27
|
-
export * from "./condition";
|
|
28
|
-
export * from "./currentProcess";
|
|
29
|
-
export * from "./dateTime";
|
|
30
|
-
export * from "./depthFirstSearch";
|
|
31
|
-
export * from "./disposable";
|
|
32
|
-
export * from "./emptyError";
|
|
33
|
-
export * from "./english";
|
|
34
|
-
export * from "./equalFunctions";
|
|
35
|
-
export * from "./fetchHttpClient";
|
|
36
|
-
export * from "./fetchHttpResponse";
|
|
37
|
-
export * from "./flatMapIterable";
|
|
38
|
-
export * from "./flatMapIterator";
|
|
39
|
-
export * from "./generator";
|
|
40
|
-
export * from "./httpClient";
|
|
41
|
-
export * from "./httpHeader";
|
|
42
|
-
export * from "./httpHeaders";
|
|
43
|
-
export * from "./httpIncomingRequest";
|
|
44
|
-
export * from "./httpIncomingResponse";
|
|
45
|
-
export * from "./httpMethod";
|
|
46
|
-
export * from "./httpOutgoingRequest";
|
|
47
|
-
export * from "./httpOutgoingResponse";
|
|
48
|
-
export * from "./httpServer";
|
|
49
|
-
export * from "./inMemoryCharacterWriteStream";
|
|
50
|
-
export * from "./iterable";
|
|
51
|
-
export * from "./iterator";
|
|
52
|
-
export * from "./iteratorToJavascriptIteratorAdapter";
|
|
53
|
-
export * from "./javascript";
|
|
54
|
-
export * from "./javascriptArrayList";
|
|
55
|
-
export * from "./javascriptAsyncIteratorToAsyncIteratorAdapter";
|
|
56
|
-
export * from "./javascriptIteratorToIteratorAdapter";
|
|
57
|
-
export * from "./javascriptMapMap";
|
|
58
|
-
export * from "./javascriptSetSet";
|
|
59
|
-
export * from "./list";
|
|
60
|
-
export * from "./listQueue";
|
|
61
|
-
export * from "./listStack";
|
|
62
|
-
export * from "./luxonDateTime";
|
|
63
|
-
export * from "./map";
|
|
64
|
-
export * from "./mapAsyncIterator";
|
|
65
|
-
export * from "./mapIterable";
|
|
66
|
-
export * from "./mapIterator";
|
|
67
|
-
export * from "./mutableCondition";
|
|
68
|
-
export * from "./mutableHttpHeaders";
|
|
69
|
-
export * from "./mutableMap";
|
|
70
|
-
export * from "./network";
|
|
71
|
-
export * from "./node";
|
|
72
|
-
export * from "./nodeJSCharacterWriteStream";
|
|
73
|
-
export * from "./nodeJSHttpIncomingRequest";
|
|
74
|
-
export * from "./nodeJSHttpServer";
|
|
75
|
-
export * from "./notFoundError";
|
|
76
|
-
export * from "./postCondition";
|
|
77
|
-
export * from "./postConditionError";
|
|
78
|
-
export * from "./preCondition";
|
|
79
|
-
export * from "./preConditionError";
|
|
80
|
-
export * from "./promiseAsyncResult";
|
|
81
|
-
export * from "./property";
|
|
82
|
-
export * from "./queue";
|
|
83
|
-
export * from "./realNetwork";
|
|
84
|
-
export * from "./recreationDotGovClient";
|
|
85
|
-
export * from "./searchControl";
|
|
86
|
-
export * from "./set";
|
|
87
|
-
export * from "./skipAsyncIterator";
|
|
88
|
-
export * from "./skipIterator";
|
|
89
|
-
export * from "./stack";
|
|
90
|
-
export * from "./stringComparer";
|
|
91
|
-
export * from "./stringIterator";
|
|
92
|
-
export * from "./strings";
|
|
93
|
-
export * from "./syncResult";
|
|
94
|
-
export * from "./takeAsyncIterator";
|
|
95
|
-
export * from "./takeIterator";
|
|
96
|
-
export * from "./toStringFunctions";
|
|
97
|
-
export * from "./types";
|
|
98
|
-
export * from "./whereAsyncIterator";
|
|
99
|
-
export * from "./whereIterable";
|
|
100
|
-
export * from "./whereIterator";
|
|
101
|
-
export * from "./wonderlandTrailClient";
|
package/sources/iterable.ts
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { Comparable } from "./comparable";
|
|
2
|
-
import { Comparer } from "./comparer";
|
|
3
|
-
import { ConcatenateIterable } from "./concatenateIterable";
|
|
4
|
-
import { EqualFunctions } from "./equalFunctions";
|
|
5
|
-
import { FlatMapIterable } from "./flatMapIterable";
|
|
6
|
-
import { Iterator } from "./iterator";
|
|
7
|
-
import { JavascriptIterable, JavascriptIterator } from "./javascript";
|
|
8
|
-
import { List } from "./list";
|
|
9
|
-
import { MapIterable } from "./mapIterable";
|
|
10
|
-
import { PreCondition } from "./preCondition";
|
|
11
|
-
import { SyncResult } from "./syncResult";
|
|
12
|
-
import { ToStringFunctions } from "./toStringFunctions";
|
|
13
|
-
import { instanceOf, isIterable, isUndefinedOrNull, Type } from "./types";
|
|
14
|
-
import { WhereIterable } from "./whereIterable";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* An object that can be iterated over.
|
|
18
|
-
*/
|
|
19
|
-
export abstract class Iterable<T> implements JavascriptIterable<T>
|
|
20
|
-
{
|
|
21
|
-
public static create<T>(values?: JavascriptIterable<T>): Iterable<T>
|
|
22
|
-
{
|
|
23
|
-
return List.create(values);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Iterate over the values in this {@link Iterable}.
|
|
28
|
-
*/
|
|
29
|
-
public abstract iterate(): Iterator<T>;
|
|
30
|
-
|
|
31
|
-
public [Symbol.iterator](): JavascriptIterator<T>
|
|
32
|
-
{
|
|
33
|
-
return Iterable[Symbol.iterator](this);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public static [Symbol.iterator]<T>(iterable: Iterable<T>): JavascriptIterator<T>
|
|
37
|
-
{
|
|
38
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
39
|
-
|
|
40
|
-
return iterable.iterate()[Symbol.iterator]();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Get all of the values in this {@link Iterable} in an {@link Array}.
|
|
45
|
-
*/
|
|
46
|
-
public toArray(): SyncResult<T[]>
|
|
47
|
-
{
|
|
48
|
-
return Iterable.toArray(this);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Get all of the values in the provided {@link Iterable} in an {@link Array}.
|
|
53
|
-
*/
|
|
54
|
-
public static toArray<T>(iterable: Iterable<T>): SyncResult<T[]>
|
|
55
|
-
{
|
|
56
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
57
|
-
|
|
58
|
-
return iterable.iterate().toArray();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Get whether this {@link Iterable} contains any values.
|
|
63
|
-
*/
|
|
64
|
-
public any(): SyncResult<boolean>
|
|
65
|
-
{
|
|
66
|
-
return Iterable.any(this);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Get whether the provided {@link JavascriptIterable} contains any values.
|
|
71
|
-
*/
|
|
72
|
-
public static any<T>(iterable: JavascriptIterable<T>): SyncResult<boolean>
|
|
73
|
-
{
|
|
74
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
75
|
-
|
|
76
|
-
return Iterator.create(iterable).any();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Get the number of values in this {@link Iterable}.
|
|
81
|
-
*/
|
|
82
|
-
public getCount(): SyncResult<number>
|
|
83
|
-
{
|
|
84
|
-
return Iterable.getCount(this);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Get the number of values in the provided {@link Iterable}.
|
|
89
|
-
*/
|
|
90
|
-
public static getCount<T>(iterable: Iterable<T>): SyncResult<number>
|
|
91
|
-
{
|
|
92
|
-
return iterable.iterate().getCount();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Get whether this {@link Iterable} is equal to the provided {@link Iterable}.
|
|
97
|
-
* @param right The {@link Iterable} to compare against this {@link Iterable}.
|
|
98
|
-
* @param equalFunctions The optional {@link EqualFunctions} to use to determine if the two
|
|
99
|
-
* {@link Iterable}s are equal.
|
|
100
|
-
*/
|
|
101
|
-
public equals(right: JavascriptIterable<T>, equalFunctions?: EqualFunctions): SyncResult<boolean>
|
|
102
|
-
{
|
|
103
|
-
return Iterable.equals(this, right, equalFunctions);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public static equals<T>(left: JavascriptIterable<T>, right: JavascriptIterable<T>, equalFunctions?: EqualFunctions): SyncResult<boolean>
|
|
107
|
-
{
|
|
108
|
-
return SyncResult.create(() =>
|
|
109
|
-
{
|
|
110
|
-
if (isUndefinedOrNull(equalFunctions))
|
|
111
|
-
{
|
|
112
|
-
equalFunctions = EqualFunctions.create();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
let result: boolean | undefined = Comparer.equalSameUndefinedNull(left, right);
|
|
116
|
-
if (result === undefined)
|
|
117
|
-
{
|
|
118
|
-
result = true;
|
|
119
|
-
|
|
120
|
-
const leftIterator: Iterator<T> = Iterator.create(left).start().await();
|
|
121
|
-
const rightIterator: Iterator<T> = Iterator.create(right).start().await();
|
|
122
|
-
while (leftIterator.hasCurrent() && rightIterator.hasCurrent())
|
|
123
|
-
{
|
|
124
|
-
result = equalFunctions.areEqual(leftIterator.getCurrent(), rightIterator.getCurrent()).await();
|
|
125
|
-
if (result === false)
|
|
126
|
-
{
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
else
|
|
130
|
-
{
|
|
131
|
-
leftIterator.next().await();
|
|
132
|
-
rightIterator.next().await();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (result)
|
|
136
|
-
{
|
|
137
|
-
result = (leftIterator.hasCurrent() === rightIterator.hasCurrent());
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return result;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Get the {@link String} representation of this {@link Iterable}.
|
|
146
|
-
*/
|
|
147
|
-
public toString(toStringFunctions?: ToStringFunctions): string
|
|
148
|
-
{
|
|
149
|
-
return Iterable.toString(this, toStringFunctions);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Get the {@link String} representation of the provided {@link Iterable}.
|
|
154
|
-
*/
|
|
155
|
-
public static toString<T>(iterable: Iterable<T>, toStringFunctions?: ToStringFunctions): string
|
|
156
|
-
{
|
|
157
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
158
|
-
|
|
159
|
-
if (isUndefinedOrNull(toStringFunctions))
|
|
160
|
-
{
|
|
161
|
-
toStringFunctions = ToStringFunctions.create();
|
|
162
|
-
}
|
|
163
|
-
return toStringFunctions.toString(iterable);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
public concatenate(...toConcatenate: JavascriptIterable<T>[]): Iterable<T>
|
|
167
|
-
{
|
|
168
|
-
return Iterable.concatenate(this, ...toConcatenate);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
public static concatenate<T>(iterable: Iterable<T>, ...toConcatenate: JavascriptIterable<T>[]): Iterable<T>
|
|
172
|
-
{
|
|
173
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterator");
|
|
174
|
-
PreCondition.assertNotUndefinedAndNotNull(toConcatenate, "toConcatenate");
|
|
175
|
-
|
|
176
|
-
return ConcatenateIterable.create(iterable, ...toConcatenate);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Get a {@link MapIterable} that maps all of the {@link T} values in this {@link Iterable} to
|
|
181
|
-
* {@link TOutput} values.
|
|
182
|
-
* @param mapping The mapping function to use to convert values of type {@link T} to
|
|
183
|
-
* {@link TOutput}.
|
|
184
|
-
*/
|
|
185
|
-
public map<TOutput>(mapping: (value: T) => (TOutput | SyncResult<TOutput>)): Iterable<TOutput>
|
|
186
|
-
{
|
|
187
|
-
return Iterable.map(this, mapping);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Get a {@link MapIterable} that maps all of the {@link T} values in the provided
|
|
192
|
-
* {@link Iterable} to {@link TOutput} values.
|
|
193
|
-
* @param mapping The mapping function to use to convert values of type {@link T} to
|
|
194
|
-
* {@link TOutput}.
|
|
195
|
-
*/
|
|
196
|
-
public static map<TInput, TOutput>(iterable: Iterable<TInput>, mapping: (value: TInput) => (TOutput | SyncResult<TOutput>)): Iterable<TOutput>
|
|
197
|
-
{
|
|
198
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
199
|
-
PreCondition.assertNotUndefinedAndNotNull(mapping, "mapping");
|
|
200
|
-
|
|
201
|
-
return MapIterable.create(iterable, mapping);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
public flatMap<TOutput>(mapping: (value: T) => JavascriptIterable<TOutput>): Iterable<TOutput>
|
|
205
|
-
{
|
|
206
|
-
return Iterable.flatMap(this, mapping);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
public static flatMap<T,TOutput>(iterable: Iterable<T>, mapping: (value: T) => JavascriptIterable<TOutput>): Iterable<TOutput>
|
|
210
|
-
{
|
|
211
|
-
return FlatMapIterable.create(iterable, mapping);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Get an {@link Iterable} that contains values from this {@link Iterable} that match the
|
|
216
|
-
* provided condition.
|
|
217
|
-
* @param condition The condition to run against each of the values in this {@link Iterable}.
|
|
218
|
-
*/
|
|
219
|
-
public where(condition: (value: T) => (boolean | SyncResult<boolean>)): Iterable<T>
|
|
220
|
-
{
|
|
221
|
-
return Iterable.where(this, condition);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Get an {@link Iterable} that contains values from the provided {@link Iterable} that match
|
|
226
|
-
* the provided condition.
|
|
227
|
-
* @param iterable The {@link Iterable} to get values from.
|
|
228
|
-
* @param condition The condition that the values must match to be contained in the new
|
|
229
|
-
* {@link Iterable}.
|
|
230
|
-
*/
|
|
231
|
-
public static where<T>(iterable: JavascriptIterable<T>, condition: (value: T) => (boolean | SyncResult<boolean>)): Iterable<T>
|
|
232
|
-
{
|
|
233
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
234
|
-
PreCondition.assertNotUndefinedAndNotNull(condition, "condition");
|
|
235
|
-
|
|
236
|
-
if (!isIterable(iterable))
|
|
237
|
-
{
|
|
238
|
-
iterable = Iterable.create(iterable);
|
|
239
|
-
}
|
|
240
|
-
return WhereIterable.create(iterable as Iterable<T>, condition);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Get an {@link Iterable} that contains values from this {@link Iterable} that match the
|
|
245
|
-
* provided {@link Type} or type check function.
|
|
246
|
-
* @param typeOrTypeCheck The {@link Type} or type check function that returned values must
|
|
247
|
-
* match.
|
|
248
|
-
*/
|
|
249
|
-
public instanceOf<TOutput extends T>(typeOrTypeCheck: Type<TOutput> | ((value: T) => value is TOutput)): Iterable<TOutput>
|
|
250
|
-
{
|
|
251
|
-
return Iterable.instanceOf(this, typeOrTypeCheck);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Get an {@link Iterable} that contains values from the provided {@link Iterable} that match
|
|
256
|
-
* the provided {@link Type} or type check function.
|
|
257
|
-
* @param iterable The {@link Iterable} to get values from.
|
|
258
|
-
* @param typeOrTypeCheck The {@link Type} or type check function that returned values must
|
|
259
|
-
* match.
|
|
260
|
-
*/
|
|
261
|
-
public static instanceOf<TInput, TOutput extends TInput>(iterable: JavascriptIterable<TInput>, typeOrTypeCheck: Type<TOutput> | ((value: TInput) => value is TOutput)): Iterable<TOutput>
|
|
262
|
-
{
|
|
263
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
264
|
-
PreCondition.assertNotUndefinedAndNotNull(typeOrTypeCheck, "typeOrTypeCheck");
|
|
265
|
-
|
|
266
|
-
return Iterable.where(iterable, (value: TInput) => instanceOf(value, typeOrTypeCheck))
|
|
267
|
-
.map((value: TInput) => (value as unknown) as TOutput);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Get the first value in this {@link Iterable}.
|
|
272
|
-
*/
|
|
273
|
-
public first(condition?: (value: T) => (boolean | SyncResult<boolean>)): SyncResult<T>
|
|
274
|
-
{
|
|
275
|
-
return Iterable.first(this, condition);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Get the first value from the provided {@link JavascriptIterable}.
|
|
280
|
-
* @param iterable The {@link JavascriptIterable} to get the first value from.
|
|
281
|
-
*/
|
|
282
|
-
public static first<T>(iterable: JavascriptIterable<T>, condition?: (value: T) => (boolean | SyncResult<boolean>)): SyncResult<T>
|
|
283
|
-
{
|
|
284
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
285
|
-
|
|
286
|
-
return Iterator.create(iterable).first(condition);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Get the last value in this {@link Iterable}.
|
|
291
|
-
*/
|
|
292
|
-
public last(condition?: (value: T) => (boolean | SyncResult<boolean>)): SyncResult<T>
|
|
293
|
-
{
|
|
294
|
-
return Iterable.last(this, condition);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Get the last value from the provided {@link JavascriptIterable}.
|
|
299
|
-
* @param iterable The {@link JavascriptIterable} to get the last value from.
|
|
300
|
-
*/
|
|
301
|
-
public static last<T>(iterable: JavascriptIterable<T>, condition?: (value: T) => (boolean | SyncResult<boolean>)): SyncResult<T>
|
|
302
|
-
{
|
|
303
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
304
|
-
|
|
305
|
-
return Iterator.create(iterable).last(condition);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Find the maximum value in the provided {@link Iterable}.
|
|
310
|
-
* @param iterable The values to find the maximum of.
|
|
311
|
-
*/
|
|
312
|
-
public static findMaximum<T extends Comparable<T>>(iterable: JavascriptIterable<T> | Iterable<T>): SyncResult<T>
|
|
313
|
-
{
|
|
314
|
-
PreCondition.assertNotUndefinedAndNotNull(iterable, "iterable");
|
|
315
|
-
|
|
316
|
-
return Iterator.findMaximum(Iterator.create(iterable));
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
public contains(value: T, equalFunctions?: EqualFunctions): SyncResult<boolean>
|
|
320
|
-
{
|
|
321
|
-
return Iterable.contains(this, value, equalFunctions);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
public static contains<T>(iterable: Iterable<T>, value: T, equalFunctions?: EqualFunctions): SyncResult<boolean>
|
|
325
|
-
{
|
|
326
|
-
return SyncResult.create(() =>
|
|
327
|
-
{
|
|
328
|
-
if (!equalFunctions)
|
|
329
|
-
{
|
|
330
|
-
equalFunctions = EqualFunctions.create();
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
let result: boolean = false;
|
|
334
|
-
for (const iterableValue of iterable)
|
|
335
|
-
{
|
|
336
|
-
if (equalFunctions.areEqual(value, iterableValue).await())
|
|
337
|
-
{
|
|
338
|
-
result = true;
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return result;
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
}
|