@everyonesoftware/common 2.0.0 → 3.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/.github/workflows/publish.yml +54 -36
- package/package.json +6 -2
- package/sources/asyncIterator.ts +436 -436
- package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +47 -47
- package/sources/asyncResult.ts +95 -95
- package/sources/byteList.ts +201 -201
- package/sources/byteListStream.ts +120 -120
- package/sources/byteReadStream.ts +23 -23
- package/sources/byteWriteStream.ts +15 -15
- package/sources/characterList.ts +194 -194
- package/sources/characterListStream.ts +150 -150
- package/sources/characterReadStream.ts +80 -80
- package/sources/characterReadStreamIterator.ts +127 -127
- package/sources/concatenateIterable.ts +118 -118
- package/sources/concatenateIterator.ts +164 -164
- package/sources/currentProcess.ts +157 -157
- package/sources/dateTime.ts +129 -129
- package/sources/depthFirstSearch.ts +229 -229
- package/sources/flatMapIterable.ts +103 -103
- package/sources/flatMapIterator.ts +151 -151
- package/sources/generator.ts +250 -250
- package/sources/index.ts +1 -1
- package/sources/iterator.ts +480 -480
- package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +123 -123
- package/sources/javascriptSetSet.ts +133 -133
- package/sources/listQueue.ts +61 -61
- package/sources/listStack.ts +61 -61
- package/sources/luxonDateTime.ts +108 -108
- package/sources/mapAsyncIterator.ts +140 -140
- package/sources/mutableMap.ts +291 -291
- package/sources/node.ts +36 -36
- package/sources/promiseAsyncResult.ts +173 -173
- package/sources/queue.ts +48 -48
- package/sources/recreationDotGovClient.ts +258 -258
- package/sources/searchControl.ts +41 -41
- package/sources/set.ts +243 -243
- package/sources/skipAsyncIterator.ts +144 -144
- package/sources/stack.ts +47 -47
- package/sources/syncResult.ts +299 -299
- package/sources/takeAsyncIterator.ts +140 -140
- package/sources/whereAsyncIterator.ts +142 -142
- package/sources/wonderlandTrailClient.ts +1502 -1502
- package/tests/assertTestTests.ts +74 -74
- package/tests/byteListStreamTests.ts +389 -389
- package/tests/byteListTests.ts +26 -26
- package/tests/characterListStreamTests.ts +390 -390
- package/tests/characterListTests.ts +249 -249
- package/tests/dateTimeTests.ts +29 -29
- package/tests/depthFirstSearchTests.ts +105 -105
- package/tests/generatorTests.ts +85 -85
- package/tests/mutableMapTests.ts +153 -153
- package/tests/promiseAsyncResultTests.ts +687 -687
- package/tests/queueTests.ts +28 -28
- package/tests/recreationDotGovClientTests.ts +190 -190
- package/tests/setTests.ts +139 -139
- package/tests/stackTests.ts +65 -65
- package/tests/syncResultTests.ts +1250 -1250
- package/tests/wonderlandTrailClientTests.ts +451 -451
- package/tsup.config.ts +12 -12
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import { AsyncIterator } from "./asyncIterator";
|
|
2
|
-
import { PromiseAsyncResult } from "./promiseAsyncResult";
|
|
3
|
-
import { CharacterReadStream } from "./characterReadStream";
|
|
4
|
-
import { JavascriptAsyncIterator } from "./javascript";
|
|
5
|
-
import { NotFoundError } from "./notFoundError";
|
|
6
|
-
import { PreCondition } from "./preCondition";
|
|
7
|
-
import { Type } from "./types";
|
|
8
|
-
|
|
9
|
-
export class CharacterReadStreamAsyncIterator implements AsyncIterator<string>
|
|
10
|
-
{
|
|
11
|
-
private readonly readStream: CharacterReadStream;
|
|
12
|
-
private current: string;
|
|
13
|
-
private started: boolean;
|
|
14
|
-
|
|
15
|
-
private constructor(readStream: CharacterReadStream)
|
|
16
|
-
{
|
|
17
|
-
PreCondition.assertNotUndefinedAndNotNull(readStream, "readStream");
|
|
18
|
-
|
|
19
|
-
this.readStream = readStream;
|
|
20
|
-
this.current = "";
|
|
21
|
-
this.started = false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public static create(readStream: CharacterReadStream): CharacterReadStreamAsyncIterator
|
|
25
|
-
{
|
|
26
|
-
return new CharacterReadStreamAsyncIterator(readStream);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public next(): PromiseAsyncResult<boolean>
|
|
30
|
-
{
|
|
31
|
-
return PromiseAsyncResult.create(async () =>
|
|
32
|
-
{
|
|
33
|
-
this.started = true;
|
|
34
|
-
|
|
35
|
-
this.current = await this.readStream.readCharacter()
|
|
36
|
-
.catch(NotFoundError, () => "");
|
|
37
|
-
|
|
38
|
-
return this.hasCurrent();
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public hasStarted(): boolean
|
|
43
|
-
{
|
|
44
|
-
return this.started;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public hasCurrent(): boolean
|
|
48
|
-
{
|
|
49
|
-
return this.current !== "";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public getCurrent(): string
|
|
53
|
-
{
|
|
54
|
-
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
55
|
-
|
|
56
|
-
return this.current;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public start(): PromiseAsyncResult<this>
|
|
60
|
-
{
|
|
61
|
-
return AsyncIterator.start<string,this>(this);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public takeCurrent(): PromiseAsyncResult<string>
|
|
65
|
-
{
|
|
66
|
-
return AsyncIterator.takeCurrent(this);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public any(): PromiseAsyncResult<boolean>
|
|
70
|
-
{
|
|
71
|
-
return AsyncIterator.any(this);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public getCount(): PromiseAsyncResult<number>
|
|
75
|
-
{
|
|
76
|
-
return AsyncIterator.getCount(this);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public toArray(): PromiseAsyncResult<string[]>
|
|
80
|
-
{
|
|
81
|
-
return AsyncIterator.toArray(this);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
public where(condition: (value: string) => boolean | PromiseLike<boolean>): AsyncIterator<string>
|
|
85
|
-
{
|
|
86
|
-
return AsyncIterator.where(this, condition);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public map<TOutput>(mapping: (value: string) => (TOutput | PromiseLike<TOutput>)): AsyncIterator<TOutput>
|
|
90
|
-
{
|
|
91
|
-
return AsyncIterator.map(this, mapping);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public whereInstanceOf<U extends string>(typeCheck: (value: string) => value is U): AsyncIterator<U>
|
|
95
|
-
{
|
|
96
|
-
return AsyncIterator.whereInstanceOf(this, typeCheck);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public whereInstanceOfType<U extends string>(type: Type<U>): AsyncIterator<U>
|
|
100
|
-
{
|
|
101
|
-
return AsyncIterator.whereInstanceOfType(this, type);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public first(condition?: (value: string) => (boolean | PromiseLike<boolean>)): PromiseAsyncResult<string>
|
|
105
|
-
{
|
|
106
|
-
return AsyncIterator.first(this, condition);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public last(condition?: (value: string) => (boolean | PromiseLike<boolean>)): PromiseAsyncResult<string>
|
|
110
|
-
{
|
|
111
|
-
return AsyncIterator.last(this, condition);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public take(maximumToTake: number): AsyncIterator<string>
|
|
115
|
-
{
|
|
116
|
-
return AsyncIterator.take(this, maximumToTake);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
public skip(maximumToSkip: number): AsyncIterator<string>
|
|
120
|
-
{
|
|
121
|
-
return AsyncIterator.skip(this, maximumToSkip);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
public [Symbol.asyncIterator](): JavascriptAsyncIterator<string>
|
|
125
|
-
{
|
|
126
|
-
return AsyncIterator[Symbol.asyncIterator](this);
|
|
127
|
-
}
|
|
1
|
+
import { AsyncIterator } from "./asyncIterator";
|
|
2
|
+
import { PromiseAsyncResult } from "./promiseAsyncResult";
|
|
3
|
+
import { CharacterReadStream } from "./characterReadStream";
|
|
4
|
+
import { JavascriptAsyncIterator } from "./javascript";
|
|
5
|
+
import { NotFoundError } from "./notFoundError";
|
|
6
|
+
import { PreCondition } from "./preCondition";
|
|
7
|
+
import { Type } from "./types";
|
|
8
|
+
|
|
9
|
+
export class CharacterReadStreamAsyncIterator implements AsyncIterator<string>
|
|
10
|
+
{
|
|
11
|
+
private readonly readStream: CharacterReadStream;
|
|
12
|
+
private current: string;
|
|
13
|
+
private started: boolean;
|
|
14
|
+
|
|
15
|
+
private constructor(readStream: CharacterReadStream)
|
|
16
|
+
{
|
|
17
|
+
PreCondition.assertNotUndefinedAndNotNull(readStream, "readStream");
|
|
18
|
+
|
|
19
|
+
this.readStream = readStream;
|
|
20
|
+
this.current = "";
|
|
21
|
+
this.started = false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public static create(readStream: CharacterReadStream): CharacterReadStreamAsyncIterator
|
|
25
|
+
{
|
|
26
|
+
return new CharacterReadStreamAsyncIterator(readStream);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public next(): PromiseAsyncResult<boolean>
|
|
30
|
+
{
|
|
31
|
+
return PromiseAsyncResult.create(async () =>
|
|
32
|
+
{
|
|
33
|
+
this.started = true;
|
|
34
|
+
|
|
35
|
+
this.current = await this.readStream.readCharacter()
|
|
36
|
+
.catch(NotFoundError, () => "");
|
|
37
|
+
|
|
38
|
+
return this.hasCurrent();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public hasStarted(): boolean
|
|
43
|
+
{
|
|
44
|
+
return this.started;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public hasCurrent(): boolean
|
|
48
|
+
{
|
|
49
|
+
return this.current !== "";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public getCurrent(): string
|
|
53
|
+
{
|
|
54
|
+
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
55
|
+
|
|
56
|
+
return this.current;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public start(): PromiseAsyncResult<this>
|
|
60
|
+
{
|
|
61
|
+
return AsyncIterator.start<string,this>(this);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public takeCurrent(): PromiseAsyncResult<string>
|
|
65
|
+
{
|
|
66
|
+
return AsyncIterator.takeCurrent(this);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public any(): PromiseAsyncResult<boolean>
|
|
70
|
+
{
|
|
71
|
+
return AsyncIterator.any(this);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public getCount(): PromiseAsyncResult<number>
|
|
75
|
+
{
|
|
76
|
+
return AsyncIterator.getCount(this);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public toArray(): PromiseAsyncResult<string[]>
|
|
80
|
+
{
|
|
81
|
+
return AsyncIterator.toArray(this);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public where(condition: (value: string) => boolean | PromiseLike<boolean>): AsyncIterator<string>
|
|
85
|
+
{
|
|
86
|
+
return AsyncIterator.where(this, condition);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public map<TOutput>(mapping: (value: string) => (TOutput | PromiseLike<TOutput>)): AsyncIterator<TOutput>
|
|
90
|
+
{
|
|
91
|
+
return AsyncIterator.map(this, mapping);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public whereInstanceOf<U extends string>(typeCheck: (value: string) => value is U): AsyncIterator<U>
|
|
95
|
+
{
|
|
96
|
+
return AsyncIterator.whereInstanceOf(this, typeCheck);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public whereInstanceOfType<U extends string>(type: Type<U>): AsyncIterator<U>
|
|
100
|
+
{
|
|
101
|
+
return AsyncIterator.whereInstanceOfType(this, type);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public first(condition?: (value: string) => (boolean | PromiseLike<boolean>)): PromiseAsyncResult<string>
|
|
105
|
+
{
|
|
106
|
+
return AsyncIterator.first(this, condition);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public last(condition?: (value: string) => (boolean | PromiseLike<boolean>)): PromiseAsyncResult<string>
|
|
110
|
+
{
|
|
111
|
+
return AsyncIterator.last(this, condition);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public take(maximumToTake: number): AsyncIterator<string>
|
|
115
|
+
{
|
|
116
|
+
return AsyncIterator.take(this, maximumToTake);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public skip(maximumToSkip: number): AsyncIterator<string>
|
|
120
|
+
{
|
|
121
|
+
return AsyncIterator.skip(this, maximumToSkip);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public [Symbol.asyncIterator](): JavascriptAsyncIterator<string>
|
|
125
|
+
{
|
|
126
|
+
return AsyncIterator[Symbol.asyncIterator](this);
|
|
127
|
+
}
|
|
128
128
|
}
|
|
@@ -1,119 +1,119 @@
|
|
|
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
|
-
}
|
|
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
119
|
}
|