@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
package/sources/generator.ts
CHANGED
|
@@ -1,251 +1,251 @@
|
|
|
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
|
-
/**
|
|
9
|
-
* A control that can be used to interact with a {@link Generator} while it is generating values.
|
|
10
|
-
*/
|
|
11
|
-
export interface GeneratorControl<T>
|
|
12
|
-
{
|
|
13
|
-
/**
|
|
14
|
-
* Add the provided value to the list of values that the {@link Generator} will return.
|
|
15
|
-
* @param value The value to add to the {@link Generator}'s list of values.
|
|
16
|
-
*/
|
|
17
|
-
addValue(value: T): void;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Add the provided values to the list of values that the {@link Generator} will return.
|
|
21
|
-
* @param returnValues The values to add to the {@link Generator}'s list of values.
|
|
22
|
-
*/
|
|
23
|
-
addValues(returnValues: JavascriptIterable<T>): void;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get whether the {@link Generator} currently has a value.
|
|
27
|
-
*/
|
|
28
|
-
hasCurrent(): boolean;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Get the current value of the {@link Generator}.
|
|
32
|
-
*/
|
|
33
|
-
getCurrent(): T;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
class InnerGeneratorControl<T> implements GeneratorControl<T>
|
|
37
|
-
{
|
|
38
|
-
private readonly returnValues: List<T>;
|
|
39
|
-
private done: boolean;
|
|
40
|
-
|
|
41
|
-
private constructor()
|
|
42
|
-
{
|
|
43
|
-
this.returnValues = List.create();
|
|
44
|
-
this.done = false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public static create<T>(): InnerGeneratorControl<T>
|
|
48
|
-
{
|
|
49
|
-
return new InnerGeneratorControl<T>();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public addValue(returnValue: T): void
|
|
53
|
-
{
|
|
54
|
-
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
55
|
-
|
|
56
|
-
this.returnValues.add(returnValue);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public addValues(returnValues: JavascriptIterable<T>): void
|
|
60
|
-
{
|
|
61
|
-
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
62
|
-
|
|
63
|
-
this.returnValues.addAll(returnValues);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public hasCurrent(): boolean
|
|
67
|
-
{
|
|
68
|
-
return this.returnValues.any().await();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public getCurrent(): T
|
|
72
|
-
{
|
|
73
|
-
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
74
|
-
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
75
|
-
|
|
76
|
-
return this.returnValues.first().await();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public removeCurrent(): void
|
|
80
|
-
{
|
|
81
|
-
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
82
|
-
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
83
|
-
|
|
84
|
-
this.returnValues.removeFirst().await();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public setDone(): void
|
|
88
|
-
{
|
|
89
|
-
PreCondition.assertFalse(this.hasCurrent(), "this.hasCurrent()");
|
|
90
|
-
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
91
|
-
|
|
92
|
-
this.done = true;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public isDone(): boolean
|
|
96
|
-
{
|
|
97
|
-
return this.done;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export class Generator<T> implements Iterator<T>
|
|
102
|
-
{
|
|
103
|
-
private readonly control: InnerGeneratorControl<T>;
|
|
104
|
-
private readonly generatorAction: (control: GeneratorControl<T>) => (void | T);
|
|
105
|
-
private started: boolean;
|
|
106
|
-
|
|
107
|
-
private constructor(generatorAction: (control: GeneratorControl<T>) => (void | T))
|
|
108
|
-
{
|
|
109
|
-
PreCondition.assertNotUndefinedAndNotNull(generatorAction, "generatorAction");
|
|
110
|
-
|
|
111
|
-
this.control = InnerGeneratorControl.create();
|
|
112
|
-
this.generatorAction = generatorAction;
|
|
113
|
-
this.started = false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public static create<T>(generatorAction: (control: GeneratorControl<T>) => (void | T)): Generator<T>
|
|
117
|
-
{
|
|
118
|
-
return new Generator<T>(generatorAction);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public next(): SyncResult<boolean>
|
|
122
|
-
{
|
|
123
|
-
return SyncResult.create(() =>
|
|
124
|
-
{
|
|
125
|
-
if (!this.control.isDone())
|
|
126
|
-
{
|
|
127
|
-
if (!this.hasStarted())
|
|
128
|
-
{
|
|
129
|
-
this.started = true;
|
|
130
|
-
}
|
|
131
|
-
else
|
|
132
|
-
{
|
|
133
|
-
this.control.removeCurrent();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (!this.control.hasCurrent())
|
|
137
|
-
{
|
|
138
|
-
const actionResult: void | T = this.generatorAction(this.control);
|
|
139
|
-
if (actionResult !== undefined)
|
|
140
|
-
{
|
|
141
|
-
this.control.addValue(actionResult);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (!this.control.hasCurrent())
|
|
145
|
-
{
|
|
146
|
-
this.control.setDone();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return this.hasCurrent();
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
public hasStarted(): boolean
|
|
156
|
-
{
|
|
157
|
-
return this.started;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
public hasCurrent(): boolean
|
|
161
|
-
{
|
|
162
|
-
return this.control.hasCurrent();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
public getCurrent(): T
|
|
166
|
-
{
|
|
167
|
-
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
168
|
-
|
|
169
|
-
return this.control.getCurrent();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public start(): SyncResult<this>
|
|
173
|
-
{
|
|
174
|
-
return Iterator.start<T, this>(this);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
public takeCurrent(): SyncResult<T>
|
|
178
|
-
{
|
|
179
|
-
return Iterator.takeCurrent(this);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
public any(): SyncResult<boolean>
|
|
183
|
-
{
|
|
184
|
-
return Iterator.any(this);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
public getCount(): SyncResult<number>
|
|
188
|
-
{
|
|
189
|
-
return Iterator.getCount(this);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
public toArray(): SyncResult<T[]>
|
|
193
|
-
{
|
|
194
|
-
return Iterator.toArray(this);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
public concatenate(...toConcatenate: JavascriptIterable<T>[]): Iterator<T>
|
|
198
|
-
{
|
|
199
|
-
return Iterator.concatenate(this, ...toConcatenate);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
public where(condition: (value: T) => (boolean | SyncResult<boolean>)): Iterator<T>
|
|
203
|
-
{
|
|
204
|
-
return Iterator.where(this, condition);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
public map<TOutput>(mapping: (value: T) => TOutput | SyncResult<TOutput>): Iterator<TOutput>
|
|
208
|
-
{
|
|
209
|
-
return Iterator.map(this, mapping);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
public flatMap<TOutput>(mapping: (value: T) => JavascriptIterable<TOutput>): Iterator<TOutput>
|
|
213
|
-
{
|
|
214
|
-
return Iterator.flatMap(this, mapping);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
public whereInstanceOf<U extends T>(typeCheck: (value: T) => value is U): Iterator<U>
|
|
218
|
-
{
|
|
219
|
-
return Iterator.whereInstanceOf(this, typeCheck);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
public whereInstanceOfType<U extends T>(type: Type<U>): Iterator<U>
|
|
223
|
-
{
|
|
224
|
-
return Iterator.whereInstanceOfType(this, type);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
public first(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
228
|
-
{
|
|
229
|
-
return Iterator.first(this, condition);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
public last(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
233
|
-
{
|
|
234
|
-
return Iterator.last(this, condition);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
public take(maximumToTake: number): Iterator<T>
|
|
238
|
-
{
|
|
239
|
-
return Iterator.take(this, maximumToTake);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
public skip(maximumToSkip: number): Iterator<T>
|
|
243
|
-
{
|
|
244
|
-
return Iterator.skip(this, maximumToSkip);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
public [Symbol.iterator](): JavascriptIterator<T>
|
|
248
|
-
{
|
|
249
|
-
return Iterator[Symbol.iterator](this);
|
|
250
|
-
}
|
|
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
|
+
/**
|
|
9
|
+
* A control that can be used to interact with a {@link Generator} while it is generating values.
|
|
10
|
+
*/
|
|
11
|
+
export interface GeneratorControl<T>
|
|
12
|
+
{
|
|
13
|
+
/**
|
|
14
|
+
* Add the provided value to the list of values that the {@link Generator} will return.
|
|
15
|
+
* @param value The value to add to the {@link Generator}'s list of values.
|
|
16
|
+
*/
|
|
17
|
+
addValue(value: T): void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Add the provided values to the list of values that the {@link Generator} will return.
|
|
21
|
+
* @param returnValues The values to add to the {@link Generator}'s list of values.
|
|
22
|
+
*/
|
|
23
|
+
addValues(returnValues: JavascriptIterable<T>): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get whether the {@link Generator} currently has a value.
|
|
27
|
+
*/
|
|
28
|
+
hasCurrent(): boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the current value of the {@link Generator}.
|
|
32
|
+
*/
|
|
33
|
+
getCurrent(): T;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class InnerGeneratorControl<T> implements GeneratorControl<T>
|
|
37
|
+
{
|
|
38
|
+
private readonly returnValues: List<T>;
|
|
39
|
+
private done: boolean;
|
|
40
|
+
|
|
41
|
+
private constructor()
|
|
42
|
+
{
|
|
43
|
+
this.returnValues = List.create();
|
|
44
|
+
this.done = false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public static create<T>(): InnerGeneratorControl<T>
|
|
48
|
+
{
|
|
49
|
+
return new InnerGeneratorControl<T>();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public addValue(returnValue: T): void
|
|
53
|
+
{
|
|
54
|
+
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
55
|
+
|
|
56
|
+
this.returnValues.add(returnValue);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public addValues(returnValues: JavascriptIterable<T>): void
|
|
60
|
+
{
|
|
61
|
+
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
62
|
+
|
|
63
|
+
this.returnValues.addAll(returnValues);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public hasCurrent(): boolean
|
|
67
|
+
{
|
|
68
|
+
return this.returnValues.any().await();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public getCurrent(): T
|
|
72
|
+
{
|
|
73
|
+
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
74
|
+
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
75
|
+
|
|
76
|
+
return this.returnValues.first().await();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public removeCurrent(): void
|
|
80
|
+
{
|
|
81
|
+
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
82
|
+
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
83
|
+
|
|
84
|
+
this.returnValues.removeFirst().await();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public setDone(): void
|
|
88
|
+
{
|
|
89
|
+
PreCondition.assertFalse(this.hasCurrent(), "this.hasCurrent()");
|
|
90
|
+
PreCondition.assertFalse(this.isDone(), "this.isDone()");
|
|
91
|
+
|
|
92
|
+
this.done = true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public isDone(): boolean
|
|
96
|
+
{
|
|
97
|
+
return this.done;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export class Generator<T> implements Iterator<T>
|
|
102
|
+
{
|
|
103
|
+
private readonly control: InnerGeneratorControl<T>;
|
|
104
|
+
private readonly generatorAction: (control: GeneratorControl<T>) => (void | T);
|
|
105
|
+
private started: boolean;
|
|
106
|
+
|
|
107
|
+
private constructor(generatorAction: (control: GeneratorControl<T>) => (void | T))
|
|
108
|
+
{
|
|
109
|
+
PreCondition.assertNotUndefinedAndNotNull(generatorAction, "generatorAction");
|
|
110
|
+
|
|
111
|
+
this.control = InnerGeneratorControl.create();
|
|
112
|
+
this.generatorAction = generatorAction;
|
|
113
|
+
this.started = false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public static create<T>(generatorAction: (control: GeneratorControl<T>) => (void | T)): Generator<T>
|
|
117
|
+
{
|
|
118
|
+
return new Generator<T>(generatorAction);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public next(): SyncResult<boolean>
|
|
122
|
+
{
|
|
123
|
+
return SyncResult.create(() =>
|
|
124
|
+
{
|
|
125
|
+
if (!this.control.isDone())
|
|
126
|
+
{
|
|
127
|
+
if (!this.hasStarted())
|
|
128
|
+
{
|
|
129
|
+
this.started = true;
|
|
130
|
+
}
|
|
131
|
+
else
|
|
132
|
+
{
|
|
133
|
+
this.control.removeCurrent();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!this.control.hasCurrent())
|
|
137
|
+
{
|
|
138
|
+
const actionResult: void | T = this.generatorAction(this.control);
|
|
139
|
+
if (actionResult !== undefined)
|
|
140
|
+
{
|
|
141
|
+
this.control.addValue(actionResult);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!this.control.hasCurrent())
|
|
145
|
+
{
|
|
146
|
+
this.control.setDone();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return this.hasCurrent();
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
public hasStarted(): boolean
|
|
156
|
+
{
|
|
157
|
+
return this.started;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public hasCurrent(): boolean
|
|
161
|
+
{
|
|
162
|
+
return this.control.hasCurrent();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
public getCurrent(): T
|
|
166
|
+
{
|
|
167
|
+
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
168
|
+
|
|
169
|
+
return this.control.getCurrent();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
public start(): SyncResult<this>
|
|
173
|
+
{
|
|
174
|
+
return Iterator.start<T, this>(this);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public takeCurrent(): SyncResult<T>
|
|
178
|
+
{
|
|
179
|
+
return Iterator.takeCurrent(this);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public any(): SyncResult<boolean>
|
|
183
|
+
{
|
|
184
|
+
return Iterator.any(this);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
public getCount(): SyncResult<number>
|
|
188
|
+
{
|
|
189
|
+
return Iterator.getCount(this);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public toArray(): SyncResult<T[]>
|
|
193
|
+
{
|
|
194
|
+
return Iterator.toArray(this);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public concatenate(...toConcatenate: JavascriptIterable<T>[]): Iterator<T>
|
|
198
|
+
{
|
|
199
|
+
return Iterator.concatenate(this, ...toConcatenate);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
public where(condition: (value: T) => (boolean | SyncResult<boolean>)): Iterator<T>
|
|
203
|
+
{
|
|
204
|
+
return Iterator.where(this, condition);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
public map<TOutput>(mapping: (value: T) => TOutput | SyncResult<TOutput>): Iterator<TOutput>
|
|
208
|
+
{
|
|
209
|
+
return Iterator.map(this, mapping);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public flatMap<TOutput>(mapping: (value: T) => JavascriptIterable<TOutput>): Iterator<TOutput>
|
|
213
|
+
{
|
|
214
|
+
return Iterator.flatMap(this, mapping);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
public whereInstanceOf<U extends T>(typeCheck: (value: T) => value is U): Iterator<U>
|
|
218
|
+
{
|
|
219
|
+
return Iterator.whereInstanceOf(this, typeCheck);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
public whereInstanceOfType<U extends T>(type: Type<U>): Iterator<U>
|
|
223
|
+
{
|
|
224
|
+
return Iterator.whereInstanceOfType(this, type);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
public first(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
228
|
+
{
|
|
229
|
+
return Iterator.first(this, condition);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
public last(condition?: ((value: T) => (boolean | SyncResult<boolean>)) | undefined): SyncResult<T>
|
|
233
|
+
{
|
|
234
|
+
return Iterator.last(this, condition);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
public take(maximumToTake: number): Iterator<T>
|
|
238
|
+
{
|
|
239
|
+
return Iterator.take(this, maximumToTake);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
public skip(maximumToSkip: number): Iterator<T>
|
|
243
|
+
{
|
|
244
|
+
return Iterator.skip(this, maximumToSkip);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
public [Symbol.iterator](): JavascriptIterator<T>
|
|
248
|
+
{
|
|
249
|
+
return Iterator[Symbol.iterator](this);
|
|
250
|
+
}
|
|
251
251
|
}
|
package/sources/index.ts
CHANGED
|
@@ -10,8 +10,8 @@ export * from "./basicDisposable";
|
|
|
10
10
|
export * from "./byteList";
|
|
11
11
|
export * from "./byteListStream";
|
|
12
12
|
export * from "./byteReadStream";
|
|
13
|
-
export * from "./bytes";
|
|
14
13
|
export * from "./byteWriteStream";
|
|
14
|
+
export * from "./bytes";
|
|
15
15
|
export * from "./characterList";
|
|
16
16
|
export * from "./characterListStream";
|
|
17
17
|
export * from "./characterReadStream";
|