@rimbu/common 1.0.0 → 2.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.
@@ -1,638 +0,0 @@
1
- import { AsyncOptLazy, CollectFun, Reducer, Eq, } from './internal.mjs';
2
- function identity(value) {
3
- return value;
4
- }
5
- export var AsyncReducer;
6
- (function (AsyncReducer) {
7
- /**
8
- * A base class that can be used to easily create `AsyncReducer` instances.
9
- * @typeparam I - the input value type
10
- * @typeparam O - the output value type
11
- * @typeparam S - the internal state type
12
- */
13
- class Base {
14
- constructor(init, next, stateToResult, onClose) {
15
- this.init = init;
16
- this.next = next;
17
- this.stateToResult = stateToResult;
18
- this.onClose = onClose;
19
- }
20
- filterInput(pred) {
21
- return create(async () => ({
22
- nextIndex: 0,
23
- state: await AsyncOptLazy.toMaybePromise(this.init),
24
- }), async (state, elem, index, halt) => {
25
- if (pred(elem, index, halt)) {
26
- state.state = await this.next(state.state, elem, state.nextIndex++, halt);
27
- }
28
- return state;
29
- }, (state) => this.stateToResult(state.state), (state, error) => this.onClose?.(state.state, error));
30
- }
31
- mapInput(mapFun) {
32
- return create(this.init, async (state, elem, index, halt) => this.next(state, await mapFun(elem, index), index, halt), this.stateToResult, this.onClose);
33
- }
34
- collectInput(collectFun) {
35
- return create(async () => ({
36
- nextIndex: 0,
37
- state: await AsyncOptLazy.toMaybePromise(this.init),
38
- }), async (state, elem, index, halt) => {
39
- const nextElem = await collectFun(elem, index, CollectFun.Skip, halt);
40
- if (CollectFun.Skip !== nextElem) {
41
- state.state = await this.next(state.state, nextElem, state.nextIndex++, halt);
42
- }
43
- return state;
44
- }, (state) => this.stateToResult(state.state), (state, error) => this.onClose?.(state.state, error));
45
- }
46
- mapOutput(mapFun) {
47
- return create(this.init, this.next, async (state) => mapFun(await this.stateToResult(state)), this.onClose);
48
- }
49
- takeInput(amount) {
50
- if (amount <= 0) {
51
- return create(this.init, identity, this.stateToResult);
52
- }
53
- return this.filterInput((_, i, halt) => {
54
- const more = i < amount;
55
- if (!more)
56
- halt();
57
- return more;
58
- });
59
- }
60
- dropInput(amount) {
61
- if (amount <= 0) {
62
- return this;
63
- }
64
- return this.filterInput((_, i) => i >= amount);
65
- }
66
- sliceInput(from = 0, amount) {
67
- if (undefined === amount)
68
- return this.dropInput(from);
69
- if (amount <= 0)
70
- return create(this.init, identity, this.stateToResult);
71
- if (from <= 0)
72
- return this.takeInput(amount);
73
- return this.takeInput(amount).dropInput(from);
74
- }
75
- }
76
- AsyncReducer.Base = Base;
77
- /**
78
- * Returns an `AsyncReducer` with the given options:
79
- * @param init - the optionally lazy and/or promised initial state value
80
- * @param next - returns (potentially asynchronously) the next state value based on the given inputs:<br/>
81
- * - current: the current state<br/>
82
- * - next: the current input value<br/>
83
- * - index: the input index value<br/>
84
- * - halt: function that, when called, ensures no more elements are passed to the reducer
85
- * @param stateToResult - a potentially asynchronous function that converts the current state to an output value
86
- * @param onClose - (optional) a function that will be called when the reducer will no longer receive values
87
- * @typeparam I - the input value type
88
- * @typeparam O - the output value type
89
- * @typeparam S - the internal state type
90
- */
91
- function create(init, next, stateToResult, onClose) {
92
- return new AsyncReducer.Base(init, next, stateToResult, onClose);
93
- }
94
- AsyncReducer.create = create;
95
- /**
96
- * Returns an `AsyncReducer` of which the input, state, and output types are the same.
97
- * @param init - the optionally lazy and/or promised initial state value
98
- * @param next - returns (potentially asynchronously) the next state value based on the given inputs:<br/>
99
- * - current: the current state<br/>
100
- * - next: the current input value<br/>
101
- * - index: the input index value<br/>
102
- * - halt: function that, when called, ensures no more elements are passed to the reducer
103
- * @param stateToResult - a potentially asynchronous function that converts the current state to an output value
104
- * @param onClose - (optional) a function that will be called when the reducer will no longer receive values
105
- * @typeparam I - the input value type
106
- * @typeparam O - the output value type
107
- * @typeparam S - the internal state type
108
- */
109
- function createMono(init, next, stateToResult, onClose) {
110
- return create(init, next, stateToResult ?? identity, onClose);
111
- }
112
- AsyncReducer.createMono = createMono;
113
- /**
114
- * Returns an `AsyncReducer` of which the state and output types are the same.
115
- * @param init - the optionally lazy and/or promised initial state value
116
- * @param next - returns (potentially asynchronously) the next state value based on the given inputs:<br/>
117
- * - current: the current state<br/>
118
- * - next: the current input value<br/>
119
- * - index: the input index value<br/>
120
- * - halt: function that, when called, ensures no more elements are passed to the reducer
121
- * @param stateToResult - a potentially asynchronous function that converts the current state to an output value
122
- * @param onClose - (optional) a function that will be called when the reducer will no longer receive values
123
- * @typeparam I - the input value type
124
- * @typeparam O - the output value type
125
- * @typeparam S - the internal state type
126
- */
127
- function createOutput(init, next, stateToResult, onClose) {
128
- return create(init, next, stateToResult ?? identity, onClose);
129
- }
130
- AsyncReducer.createOutput = createOutput;
131
- function from(reducer) {
132
- return AsyncReducer.create(reducer.init, reducer.next, reducer.stateToResult);
133
- }
134
- AsyncReducer.from = from;
135
- /**
136
- * A `Reducer` that sums all given numeric input values.
137
- * @example
138
- * ```ts
139
- * console.log(Stream.range({ amount: 5 }).reduce(Reducer.sum))
140
- * // => 10
141
- * ```
142
- */
143
- AsyncReducer.sum = createMono(0, (state, next) => state + next);
144
- /**
145
- * A `Reducer` that calculates the product of all given numeric input values.
146
- * @example
147
- * ```ts
148
- * console.log(Stream.range({ start: 1, amount: 5 }).reduce(product))
149
- * // => 120
150
- * ```
151
- */
152
- AsyncReducer.product = createMono(1, (state, next, _, halt) => {
153
- if (0 === next)
154
- halt();
155
- return state * next;
156
- });
157
- /**
158
- * A `Reducer` that calculates the average of all given numberic input values.
159
- * @example
160
- * ```ts
161
- * console.log(Stream.range({ amount: 5 }).reduce(Reducer.average));
162
- * // => 2
163
- * ```
164
- */
165
- AsyncReducer.average = createMono(0, (avg, value, index) => avg + (value - avg) / (index + 1));
166
- /**
167
- * Returns a `Reducer` that remembers the minimum value of the inputs using the given `compFun` to compare input values
168
- * @param compFun - a comparison function for two input values, returning 0 when equal, positive when greater, negetive when smaller
169
- * @param otherwise - (default: undefineds) a fallback value when there were no input values given
170
- * @example
171
- * ```ts
172
- * const stream = Stream.of('abc', 'a', 'abcde', 'ab')
173
- * console.log(stream.minBy((s1, s2) => s1.length - s2.length))
174
- * // 'a'
175
- * ```
176
- */
177
- AsyncReducer.minBy = (compFun, otherwise) => {
178
- const token = Symbol();
179
- return create(token, async (state, next) => {
180
- if (token === state)
181
- return next;
182
- return (await compFun(state, next)) < 0 ? state : next;
183
- }, (state) => token === state ? AsyncOptLazy.toMaybePromise(otherwise) : state);
184
- };
185
- /**
186
- * Returns a `Reducer` that remembers the minimum value of the numberic inputs.
187
- * @param otherwise - (default: undefined) a fallback value when there were no input values given
188
- * @example
189
- * ```ts
190
- * console.log(Stream.of(5, 3, 7, 4).reduce(Reducer.min()))
191
- * // => 3
192
- * ```
193
- */
194
- // prettier-ignore
195
- AsyncReducer.min = (otherwise) => {
196
- return create(undefined, (state, next) => undefined !== state && state < next ? state : next, (state) => state ?? AsyncOptLazy.toMaybePromise(otherwise));
197
- };
198
- /**
199
- * Returns a `Reducer` that remembers the maximum value of the inputs using the given `compFun` to compare input values
200
- * @param compFun - a comparison function for two input values, returning 0 when equal, positive when greater, negetive when smaller
201
- * @param otherwise - (default: undefined) a fallback value when there were no input values given
202
- * @example
203
- * ```ts
204
- * const stream = Stream.of('abc', 'a', 'abcde', 'ab')
205
- * console.log(stream.maxBy((s1, s2) => s1.length - s2.length))
206
- * // 'abcde'
207
- * ```
208
- */
209
- AsyncReducer.maxBy = (compFun, otherwise) => {
210
- const token = Symbol();
211
- return create(token, async (state, next) => {
212
- if (token === state)
213
- return next;
214
- return (await compFun(state, next)) > 0 ? state : next;
215
- }, (state) => token === state ? AsyncOptLazy.toMaybePromise(otherwise) : state);
216
- };
217
- /**
218
- * Returns a `Reducer` that remembers the maximum value of the numberic inputs.
219
- * @param otherwise - (default: undefined) a fallback value when there were no input values given
220
- * @example
221
- * ```ts
222
- * console.log(Stream.of(5, 3, 7, 4).reduce(Reducer.max()))
223
- * // => 7
224
- * ```
225
- */
226
- // prettier-ignore
227
- AsyncReducer.max = (otherwise) => {
228
- return create(undefined, (state, next) => undefined !== state && state > next ? state : next, (state) => state ?? AsyncOptLazy.toMaybePromise(otherwise));
229
- };
230
- /**
231
- * Returns a `Reducer` that joins the given input values into a string using the given options.
232
- * @param options - an object containing:<br/>
233
- * - sep: (optional) a seperator string value between values in the output<br/>
234
- * - start: (optional) a start string to prepend to the output<br/>
235
- * - end: (optional) an end string to append to the output<br/>
236
- * @example
237
- * ```ts
238
- * console.log(Stream.of(1, 2, 3).reduce(Reducer.join({ sep: '-' })))
239
- * // => '1-2-3'
240
- * ```
241
- */
242
- function join({ sep = '', start = '', end = '', valueToString = String, } = {}) {
243
- let curSep = '';
244
- let curStart = start;
245
- return create('', (state, next) => {
246
- const result = curStart.concat(state, curSep, valueToString(next));
247
- curSep = sep;
248
- curStart = '';
249
- return result;
250
- }, (state) => state.concat(end));
251
- }
252
- AsyncReducer.join = join;
253
- /**
254
- * Returns an `AsyncReducer` that remembers the amount of input items provided.
255
- * @param pred - (optional) a predicate that returns false if the item should not be counted given:<br/>
256
- * - value: the current input value<br/>
257
- * - index: the input value index
258
- * @example
259
- * ```ts
260
- * const stream = AsyncStream.from(Stream.range({ amount: 10 }))
261
- * console.log(await stream.reduce(AsyncReducer.count()))
262
- * // => 10
263
- * console.log(await stream.reduce(AsyncReducer.count(async v => v < 5)))
264
- * // => 5
265
- * ```
266
- */
267
- AsyncReducer.count = (pred) => {
268
- if (undefined === pred)
269
- return createOutput(0, (_, __, i) => i + 1);
270
- return createOutput(0, async (state, next, i) => {
271
- if (await pred?.(next, i))
272
- return state + 1;
273
- return state;
274
- });
275
- };
276
- /**
277
- * Returns an `AsyncReducer` that remembers the first input value for which the given `pred` function returns true.
278
- * @param pred - a function taking an input value and its index, and returning true if the value should be remembered
279
- * @param otherwise - (default: undefined) a fallback value to output if no input value yet has satisfied the given predicate
280
- * @typeparam T - the input value type
281
- * @typeparam O - the fallback value type
282
- * @example
283
- * ```ts
284
- * await AsyncStream.from(Stream.range({ amount: 10 })).reduce(AsyncReducer.firstWhere(async v => v > 5)))
285
- * // => 6
286
- * ```
287
- */
288
- AsyncReducer.firstWhere = (pred, otherwise) => {
289
- const token = Symbol();
290
- return create(token, async (state, next, i, halt) => {
291
- if (token === state && (await pred(next, i))) {
292
- halt();
293
- return next;
294
- }
295
- return state;
296
- }, (state) => token === state ? AsyncOptLazy.toMaybePromise(otherwise) : state);
297
- };
298
- /**
299
- * Returns an `AsyncReducer` that remembers the first input value.
300
- * @param otherwise - (default: undefined) a fallback value to output if no input value has been provided
301
- * @typeparam T - the input value type
302
- * @typeparam O - the fallback value type
303
- * @example
304
- * ```ts
305
- * await AsyncStream.from(Stream.range{ amount: 10 })).reduce(AsyncReducer.first())
306
- * // => 0
307
- * ```
308
- */
309
- AsyncReducer.first = (otherwise) => {
310
- const token = Symbol();
311
- return create(token, (state, next, _, halt) => {
312
- halt();
313
- if (token === state)
314
- return next;
315
- return state;
316
- }, (state) => token === state ? AsyncOptLazy.toMaybePromise(otherwise) : state);
317
- };
318
- /**
319
- * Returns an `AsyncReducer` that remembers the last input value for which the given `pred` function returns true.
320
- * @param pred - a function taking an input value and its index, and returning true if the value should be remembered
321
- * @param otherwise - (default: undefined) a fallback value to output if no input value yet has satisfied the given predicate
322
- * @typeparam T - the input value type
323
- * @typeparam O - the fallback value type
324
- * @example
325
- * ```ts
326
- * await AsyncStream.from(Stream.range({ amount: 10 })).reduce(AsyncReducer.lastWhere(async v => v > 5)))
327
- * // => 9
328
- * ```
329
- */
330
- AsyncReducer.lastWhere = (pred, otherwise) => {
331
- const token = Symbol();
332
- return create(token, async (state, next, i) => {
333
- if (await pred(next, i))
334
- return next;
335
- return state;
336
- }, (state) => token === state ? AsyncOptLazy.toMaybePromise(otherwise) : state);
337
- };
338
- /**
339
- * Returns an `AsyncReducer` that remembers the last input value.
340
- * @param otherwise - (default: undefined) a fallback value to output if no input value has been provided
341
- * @typeparam T - the input value type
342
- * @typeparam O - the fallback value type
343
- * @example
344
- * ```ts
345
- * await AsyncStream.from(Stream.range{ amount: 10 })).reduce(AsyncReducer.last())
346
- * // => 9
347
- * ```
348
- */
349
- AsyncReducer.last = (otherwise) => {
350
- const token = Symbol();
351
- return create(() => token, (_, next) => next, (state) => token === state ? AsyncOptLazy.toMaybePromise(otherwise) : state);
352
- };
353
- /**
354
- * Returns a `Reducer` that ouputs false as long as no input value satisfies given `pred`, true otherwise.
355
- * @typeparam T - the element type
356
- * @param pred - a function taking an input value and its index, and returning true if the value satisfies the predicate
357
- * @example
358
- * ```ts
359
- * await AsyncStream.from(Stream.range{ amount: 10 })).reduce(AsyncReducer.some(async v => v > 5))
360
- * // => true
361
- * ```
362
- */
363
- function some(pred) {
364
- return createOutput(false, async (state, next, i, halt) => {
365
- if (state)
366
- return state;
367
- const satisfies = await pred(next, i);
368
- if (satisfies) {
369
- halt();
370
- }
371
- return satisfies;
372
- });
373
- }
374
- AsyncReducer.some = some;
375
- /**
376
- * Returns an `AsyncReducer` that ouputs true as long as all input values satisfy the given `pred`, false otherwise.
377
- * @typeparam T - the element type
378
- * @param pred - a function taking an input value and its index, and returning true if the value satisfies the predicate
379
- * @example
380
- * ```ts
381
- * await AsyncStream.from(Stream.range{ amount: 10 })).reduce(AsyncReducer.every(async v => v < 5))
382
- * // => false
383
- * ```
384
- */
385
- function every(pred) {
386
- return createOutput(true, async (state, next, i, halt) => {
387
- if (!state)
388
- return state;
389
- const satisfies = await pred(next, i);
390
- if (!satisfies) {
391
- halt();
392
- }
393
- return satisfies;
394
- });
395
- }
396
- AsyncReducer.every = every;
397
- /**
398
- * Returns an `AsyncReducer` that outputs false as long as the given `elem` has not been encountered in the input values, true otherwise.
399
- * @typeparam T - the element type
400
- * @param elem - the element to search for
401
- * @param eq - (optional) a comparison function that returns true if te two given input values are considered equal
402
- * @example
403
- * ```ts
404
- * await AsyncStream.from(Stream.range({ amount: 10 })).reduce(AsyncReducer.contains(5)))
405
- * // => true
406
- * ```
407
- */
408
- function contains(elem, eq = Object.is) {
409
- return createOutput(false, (state, next, _, halt) => {
410
- if (state)
411
- return state;
412
- const satisfies = eq(next, elem);
413
- if (satisfies) {
414
- halt();
415
- }
416
- return satisfies;
417
- });
418
- }
419
- AsyncReducer.contains = contains;
420
- /**
421
- * Returns an `AsyncReducer` that takes boolean values and outputs true if all input values are true, and false otherwise.
422
- * @example
423
- * ```ts
424
- * await AsyncStream.of(true, false, true)).reduce(AsyncReducer.and))
425
- * // => false
426
- * ```
427
- */
428
- AsyncReducer.and = createMono(true, (state, next, _, halt) => {
429
- if (!state)
430
- return state;
431
- if (!next)
432
- halt();
433
- return next;
434
- });
435
- /**
436
- * Returns an `AsyncReducer` that takes boolean values and outputs true if one or more input values are true, and false otherwise.
437
- * @example
438
- * ```ts
439
- * await AsyncStream.of(true, false, true)).reduce(AsyncReducer.or))
440
- * // => true
441
- * ```
442
- */
443
- AsyncReducer.or = createMono(false, (state, next, _, halt) => {
444
- if (state)
445
- return state;
446
- if (next)
447
- halt();
448
- return next;
449
- });
450
- /**
451
- * Returns an `AsyncReducer` that outputs true if no input values are received, false otherwise.
452
- * @example
453
- * ```ts
454
- * await AsyncStream.of(1, 2, 3).reduce(AsyncReducer.isEmpty))
455
- * // => false
456
- * ```
457
- */
458
- AsyncReducer.isEmpty = createOutput(true, (_, __, ___, halt) => {
459
- halt();
460
- return false;
461
- });
462
- /**
463
- * Returns an `AsyncReducer` that outputs true if one or more input values are received, false otherwise.
464
- * @example
465
- * ```ts
466
- * await AsyncStream.of(1, 2, 3).reduce(AsyncReducer.nonEmpty))
467
- * // => true
468
- * ```
469
- */
470
- AsyncReducer.nonEmpty = createOutput(false, (_, __, ___, halt) => {
471
- halt();
472
- return true;
473
- });
474
- /**
475
- * Returns an `AsyncReducer` that collects received input values in an array, and returns a copy of that array as an output value when requested.
476
- * @typeparam T - the element type
477
- * @example
478
- * ```ts
479
- * await AsyncStream.of(1, 2, 3).reduce(AsyncReducer.toArray()))
480
- * // => [1, 2, 3]
481
- * ```
482
- */
483
- function toArray() {
484
- return create(() => [], (state, next) => {
485
- state.push(next);
486
- return state;
487
- }, (state) => state.slice());
488
- }
489
- AsyncReducer.toArray = toArray;
490
- /**
491
- * Returns a `AsyncReducer` that collects received input tuples into a mutable JS Map, and returns
492
- * a copy of that map when output is requested.
493
- * @typeparam K - the map key type
494
- * @typeparam V - the map value type
495
- * @example
496
- * ```ts
497
- * await AsyncStream.of([1, 'a'], [2, 'b']).reduce(AsyncReducer.toJSMap()))
498
- * // Map { 1 => 'a', 2 => 'b' }
499
- * ```
500
- */
501
- function toJSMap() {
502
- return create(() => new Map(), (state, next) => {
503
- state.set(next[0], next[1]);
504
- return state;
505
- }, (s) => new Map(s));
506
- }
507
- AsyncReducer.toJSMap = toJSMap;
508
- /**
509
- * Returns an `AsyncReducer` that collects received input values into a mutable JS Set, and returns
510
- * a copy of that map when output is requested.
511
- * @typeparam T - the element type
512
- * @example
513
- * ```ts
514
- * await AsyncStream.of(1, 2, 3).reduce(AsyncReducer.toJSSet()))
515
- * // Set {1, 2, 3}
516
- * ```
517
- */
518
- function toJSSet() {
519
- return create(() => new Set(), (state, next) => {
520
- state.add(next);
521
- return state;
522
- }, (s) => new Set(s));
523
- }
524
- AsyncReducer.toJSSet = toJSSet;
525
- /**
526
- * Returns an `AsyncReducer` that collects 2-tuples containing keys and values into a plain JS object, and
527
- * returns a copy of that object when output is requested.
528
- * @typeparam K - the result object key type
529
- * @typeparam V - the result object value type
530
- * @example
531
- * ```ts
532
- * await AsyncStream.of(['a', 1], ['b', true]).reduce(AsyncReducer.toJSObject()))
533
- * // { a: 1, b: true }
534
- * ```
535
- */
536
- function toJSObject() {
537
- return create(() => ({}), (state, entry) => {
538
- state[entry[0]] = entry[1];
539
- return state;
540
- }, (s) => ({ ...s }));
541
- }
542
- AsyncReducer.toJSObject = toJSObject;
543
- /**
544
- * Returns an `AsyncReducer` that combines multiple input `reducers` by providing input values to all of them and collecting the outputs in an array.
545
- * @param reducers - 2 or more reducers to combine
546
- * @example
547
- * ```ts
548
- * const red = AsyncReducer.combineArr(AsyncReducer.sum, AsyncReducer.average)
549
- *
550
- * await AsyncStream.from(Stream.range({ amount: 9 }))
551
- * .reduce(red)
552
- * // => [36, 4]
553
- * ```
554
- */
555
- function combineArr(...reducers) {
556
- const createState = () => {
557
- return Promise.all(reducers.map(async (reducer) => {
558
- const result = {
559
- reducer,
560
- halted: false,
561
- halt() {
562
- result.halted = true;
563
- },
564
- state: await AsyncOptLazy.toMaybePromise(reducer.init),
565
- };
566
- return result;
567
- }));
568
- };
569
- return create(createState, async (allState, next, index, halt) => {
570
- let anyNotHalted = false;
571
- await Promise.all(allState.map(async (red) => {
572
- if (red.halted)
573
- return;
574
- red.state = await red.reducer.next(red.state, next, index, red.halt);
575
- if (!red.halted)
576
- anyNotHalted = true;
577
- }));
578
- if (!anyNotHalted)
579
- halt();
580
- return allState;
581
- }, (allState) => Promise.all(allState.map((st) => st.reducer.stateToResult(st.state))));
582
- }
583
- AsyncReducer.combineArr = combineArr;
584
- /**
585
- * Returns an `AsyncReducer` that combines multiple input `reducers` by providing input values to all of them and collecting the outputs in the shape of the given object.
586
- * @typeparam T - the input type for all the reducers
587
- * @typeparam R - the result object shape
588
- * @param reducerObj - an object of keys, and reducers corresponding to those keys
589
- * @example
590
- * ```ts
591
- * const red = AsyncReducer.combineObj({
592
- * theSum: Reducer.sum,
593
- * theAverage: Reducer.average
594
- * });
595
- *
596
- * await AsyncStream.from(Stream.range({ amount: 9 }))
597
- * .reduce(red));
598
- * // => { theSum: 36, theAverage: 4 }
599
- * ```
600
- */
601
- function combineObj(reducerObj) {
602
- const createState = async () => {
603
- const entries = await Promise.all(Object.entries(reducerObj).map(async ([key, reducer]) => {
604
- const result = {
605
- reducer,
606
- halted: false,
607
- halt() {
608
- result.halted = true;
609
- },
610
- state: await AsyncOptLazy.toMaybePromise(reducer.init),
611
- };
612
- return [key, result];
613
- }));
614
- return Object.fromEntries(entries);
615
- };
616
- return create(createState, async (allState, next, index, halt) => {
617
- let anyNotHalted = false;
618
- await Promise.all(Object.values(allState).map(async (red) => {
619
- if (red.halted) {
620
- return;
621
- }
622
- red.state = await red.reducer.next(red.state, next, index, red.halt);
623
- if (!red.halted) {
624
- anyNotHalted = true;
625
- }
626
- }));
627
- if (!anyNotHalted) {
628
- halt();
629
- }
630
- return allState;
631
- }, async (allState) => {
632
- const entries = await Promise.all(Object.entries(allState).map(async ([key, st]) => [key, await st.reducer.stateToResult(st.state)]));
633
- return Object.fromEntries(entries);
634
- });
635
- }
636
- AsyncReducer.combineObj = combineObj;
637
- })(AsyncReducer || (AsyncReducer = {}));
638
- //# sourceMappingURL=async-reducer.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async-reducer.mjs","sourceRoot":"","sources":["../../src/async-reducer.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,UAAU,EAEV,OAAO,EACP,EAAE,GACH,MAAM,gBAAgB,CAAC;AAUxB,SAAS,QAAQ,CAAI,KAAQ;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,KAAW,YAAY,CA+mC5B;AA/mCD,WAAiB,YAAY;IA2I3B;;;;;OAKG;IACH,MAAa,IAAI;QACf,YACW,IAAqB,EACrB,IAKW,EACX,aAA4C,EAC5C,OAA2D;YAR3D,SAAI,GAAJ,IAAI,CAAiB;YACrB,SAAI,GAAJ,IAAI,CAKO;YACX,kBAAa,GAAb,aAAa,CAA+B;YAC5C,YAAO,GAAP,OAAO,CAAoD;QACnE,CAAC;QAEJ,WAAW,CACT,IAA0E;YAE1E,OAAO,MAAM,CACX,KAAK,IAA8C,EAAE,CAAC,CAAC;gBACrD,SAAS,EAAE,CAAC;gBACZ,KAAK,EAAE,MAAM,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;aACpD,CAAC,EACF,KAAK,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,IAAI,EACsC,EAAE;gBAC5C,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,E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