@zwa73/utils 1.0.90 → 1.0.93

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,2 +1,2 @@
1
1
  import { UtilFunc } from "./UtilFunctions";
2
- export declare const outcome: typeof UtilFunc.outcome, matchProc: typeof UtilFunc.matchProc, sucesProc: typeof UtilFunc.sucesProc, isFailed: typeof UtilFunc.isFailed, isSafeNumber: typeof UtilFunc.isSafeNumber, isSuccess: typeof UtilFunc.isSuccess, assertType: typeof UtilFunc.assertType, assertLiteral: typeof UtilFunc.assertLiteral, deepClone: typeof UtilFunc.deepClone, sleep: typeof UtilFunc.sleep, stringifyJToken: typeof UtilFunc.stringifyJToken, getTime: typeof UtilFunc.getTime, mapEntries: typeof UtilFunc.mapEntries, composeMixinable: typeof UtilFunc.composeMixinable;
2
+ export declare const outcome: typeof UtilFunc.outcome, matchProc: typeof UtilFunc.matchProc, sucesProc: typeof UtilFunc.sucesProc, isFailed: typeof UtilFunc.isFailed, isSafeNumber: typeof UtilFunc.isSafeNumber, isSuccess: typeof UtilFunc.isSuccess, likeNone: typeof UtilFunc.likeNone, expect: typeof UtilFunc.expect, assertType: typeof UtilFunc.assertType, assertLiteral: typeof UtilFunc.assertLiteral, deepClone: typeof UtilFunc.deepClone, sleep: typeof UtilFunc.sleep, stringifyJToken: typeof UtilFunc.stringifyJToken, getTime: typeof UtilFunc.getTime, mapEntries: typeof UtilFunc.mapEntries, composeMixinable: typeof UtilFunc.composeMixinable;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.composeMixinable = exports.mapEntries = exports.getTime = exports.stringifyJToken = exports.sleep = exports.deepClone = exports.assertLiteral = exports.assertType = exports.isSuccess = exports.isSafeNumber = exports.isFailed = exports.sucesProc = exports.matchProc = exports.outcome = void 0;
3
+ exports.composeMixinable = exports.mapEntries = exports.getTime = exports.stringifyJToken = exports.sleep = exports.deepClone = exports.assertLiteral = exports.assertType = exports.expect = exports.likeNone = exports.isSuccess = exports.isSafeNumber = exports.isFailed = exports.sucesProc = exports.matchProc = exports.outcome = void 0;
4
4
  const UtilFunctions_1 = require("./UtilFunctions");
5
5
  const UtilSymbol_1 = require("./UtilSymbol");
6
- exports.outcome = UtilFunctions_1.UtilFunc.outcome, exports.matchProc = UtilFunctions_1.UtilFunc.matchProc, exports.sucesProc = UtilFunctions_1.UtilFunc.sucesProc, exports.isFailed = UtilFunctions_1.UtilFunc.isFailed, exports.isSafeNumber = UtilFunctions_1.UtilFunc.isSafeNumber, exports.isSuccess = UtilFunctions_1.UtilFunc.isSuccess, exports.assertType = UtilFunctions_1.UtilFunc.assertType, exports.assertLiteral = UtilFunctions_1.UtilFunc.assertLiteral, exports.deepClone = UtilFunctions_1.UtilFunc.deepClone, exports.sleep = UtilFunctions_1.UtilFunc.sleep, exports.stringifyJToken = UtilFunctions_1.UtilFunc.stringifyJToken, exports.getTime = UtilFunctions_1.UtilFunc.getTime, exports.mapEntries = UtilFunctions_1.UtilFunc.mapEntries, exports.composeMixinable = UtilFunctions_1.UtilFunc.composeMixinable;
6
+ exports.outcome = UtilFunctions_1.UtilFunc.outcome, exports.matchProc = UtilFunctions_1.UtilFunc.matchProc, exports.sucesProc = UtilFunctions_1.UtilFunc.sucesProc, exports.isFailed = UtilFunctions_1.UtilFunc.isFailed, exports.isSafeNumber = UtilFunctions_1.UtilFunc.isSafeNumber, exports.isSuccess = UtilFunctions_1.UtilFunc.isSuccess, exports.likeNone = UtilFunctions_1.UtilFunc.likeNone, exports.expect = UtilFunctions_1.UtilFunc.expect, exports.assertType = UtilFunctions_1.UtilFunc.assertType, exports.assertLiteral = UtilFunctions_1.UtilFunc.assertLiteral, exports.deepClone = UtilFunctions_1.UtilFunc.deepClone, exports.sleep = UtilFunctions_1.UtilFunc.sleep, exports.stringifyJToken = UtilFunctions_1.UtilFunc.stringifyJToken, exports.getTime = UtilFunctions_1.UtilFunc.getTime, exports.mapEntries = UtilFunctions_1.UtilFunc.mapEntries, exports.composeMixinable = UtilFunctions_1.UtilFunc.composeMixinable;
7
7
  if (false) {
8
8
  let aaser = (0, exports.assertLiteral)({ a: 1 });
9
9
  let a = null;
@@ -1,505 +1,3 @@
1
- /**遍历函数
2
- */
3
- interface EachCallback<T> {
4
- /**
5
- * @param {T} value - 值
6
- * @param {number} index - 下标
7
- * @param {SList<T>} list - 数组
8
- * @returns {void}
9
- */
10
- (value: T, index: number, list: SList<T>): void;
11
- }
12
- /**加工函数
13
- */
14
- interface MapCallback<T, U> {
15
- /**
16
- * @param {T} value - 值
17
- * @param {number} index - 下标
18
- * @param {SList<T>} list - 数组
19
- * @returns {U} - 返回值
20
- */
21
- (value: T, index: number, list: SList<T>): U;
22
- }
23
- /**过滤函数
24
- */
25
- interface FiltCallback<T> {
26
- /**
27
- * @param {T} value - 值
28
- * @param {number} index - 下标
29
- * @param {SList<T>} list - 数组
30
- * @returns {boolean} - 返回值
31
- */
32
- (value: T, index: number, list: SList<T>): boolean;
33
- }
34
- /**统计函数
35
- */
36
- interface AggrCallback<T, U> {
37
- /**
38
- * @param {U} accumulator - 累加器
39
- * @param {T} value - 值
40
- * @param {number} index - 下标
41
- * @param {SList<T>} list - 数组
42
- * @returns {U} - 返回值
43
- */
44
- (accumulator: U, value: T, index: number, list: SList<T>): U;
45
- }
46
- /**缩减函数
47
- */
48
- interface ReduceCallback<T> {
49
- /**
50
- * @param {T} previousValue - 上一个值/累加值
51
- * @param {T} currentValue - 当前值
52
- * @param {number} currentIndex - 当前下标
53
- * @param {SList<T>} list - 数组
54
- * @returns {T} - 返回值
55
- */
56
- (previousValue: T, currentValue: T, currentIndex: number, list: SList<T>): T;
57
- }
58
- /**排序函数
59
- */
60
- interface SortCallback<T> {
61
- /**
62
- * @param {T} a - 值a
63
- * @param {T} b - 值b
64
- * @returns {number} - 返回值
65
- */
66
- (a: T, b: T): number;
67
- }
68
- export declare class SList<T> {
69
- private _arr;
70
- /**建立0长度的SList */
71
- constructor();
72
- /**建立一个长度为 obj 的SList */
73
- constructor(obj: number);
74
- /**根据obj建立SList */
75
- constructor(obj: Array<T>);
76
- /**返回数组长度
77
- * @returns {number} - 长度
78
- */
79
- size(): number;
80
- /**获取指定下标的元素
81
- * @param {number} index - 下标
82
- * @returns {T} - 目标元素
83
- */
84
- get(index: number): T;
85
- /**设置指定下标的元素
86
- * 返回自身 改变自身
87
- * @param {number} index - 下标
88
- * @param {T} value - 值
89
- * @returns {SList<T>} - 自身
90
- */
91
- set(index: number, value: T): SList<T>;
92
- /**连接两个数组
93
- * @param {SList<T>} list - 目标数组
94
- * @returns {SList<T>} - 新数组
95
- */
96
- concat(list: SList<T>): SList<T>;
97
- /**在数组末尾添加一个元素
98
- * 返回自身 改变自身
99
- * @param {T} value - 值
100
- * @returns {SList<T>} - 自身
101
- */
102
- push(value: T): SList<T>;
103
- /**在数组末尾添加一个数组
104
- * 改变自身
105
- * @param {SList<T>} list - 目标数组
106
- * @returns {SList<T>} - 自身
107
- */
108
- pushList(list: SList<T>): this;
109
- /**截取从起始点到结束点之前的一段数组
110
- * @param {number} strat - 起始点
111
- * @param {number} end - 结束点
112
- * @returns {SList<T>} - 新数组
113
- */
114
- slice(strat: number, end: number): SList<T>;
115
- /**翻转数组
116
- * 改变自身
117
- * @returns {SList<T>} - 自身
118
- */
119
- reverse(): SList<T>;
120
- /**将SList转换为数组
121
- * @returns {Array<T>} - 数组
122
- */
123
- toArray(): Array<T>;
124
- /**将SList转换为SStream
125
- * @param {number} concurrent - 并发数
126
- * @returns {SStream<T>} - 流
127
- */
128
- toSStream(concurrent?: number): SStream<T>;
129
- /**返回指定元素在数组中首次出现的位置
130
- * @param {T} value - 目标元素
131
- * @returns {number} - 下标
132
- */
133
- indexOf(value: T): number;
134
- /**返回指定元素在数组中最后一次出现的位置
135
- * @param {T} value - 目标元素
136
- * @returns {number} - 下标
137
- */
138
- lastIndexOf(value: T): number;
139
- /**判断数组中是否包含指定元素
140
- * @param {T} value - 目标元素
141
- * @returns {boolean} - 是否包含
142
- */
143
- contains(value: T): boolean;
144
- /**获取迭代器
145
- * @returns {SIterator<T>} - 迭代器
146
- */
147
- iterator(): SIterator<T>;
148
- /**平分数组
149
- * @param {number} count - 份数
150
- * @param {"average" | "chunk"} mode - 模式 average:轮询平均分 chunk:切块均分
151
- * @returns {SList<SList<T>>} - 新数组
152
- */
153
- divide(count: number, mode?: "average" | "chunk"): SList<SList<T>>;
154
- /**从index开始删除count个元素,返回删除的元素数组
155
- * 改变自身
156
- * @param {number} index - 起始点
157
- * @param {number} count - 数量
158
- * @returns {SList<T>} - 删除的元素数组
159
- */
160
- removeRange(index: number, count: number): SList<T>;
161
- /**删除对应下标下的元素,返回删除的元素
162
- * 改变自身
163
- * @param {number} i - 下标
164
- * @returns {T|null} - 删除的元素
165
- */
166
- remove(i: number): T | null;
167
- /**删除第一个匹配的项目,返回自身
168
- * 改变自身
169
- * @param {T} obj - 需删除目标
170
- * @returns {SList<T>} - 自身
171
- */
172
- removeMember(obj: T): SList<T>;
173
- /**删除所有匹配的项目
174
- * 改变自身
175
- * @param {T} obj - 需删除目标
176
- * @returns {SList<T>} - 自身
177
- */
178
- removeAllMember(obj: T): SList<T>;
179
- /**在这个下标对应的元素前添加一个元素
180
- * 改变自身
181
- * @param {number} index - 下标
182
- * @param {T} obj - 添加对象
183
- * @returns {SList<T>} - 自身
184
- */
185
- insert(index: number, obj: T): SList<T>;
186
- /**在这个下标对应的元素前添加一组元素
187
- * 改变自身
188
- * @param {number} index - 下标
189
- * @param {SList<T>} obj - 添加对象
190
- * @returns {SList<T>} - 自身
191
- */
192
- insertRange(index: number, obj: SList<T>): SList<T>;
193
- /**删除并返回最后一个元素
194
- * 改变自身
195
- * @returns {T | null} - 最后一个元素
196
- */
197
- pop(): T | null;
198
- /**删除并返回第一个元素
199
- * 改变自身
200
- * @returns {T | null} - 第一个元素
201
- */
202
- shift(): T | null;
203
- /**克隆数组
204
- * @returns {SList<T>} - 新数组
205
- */
206
- clone(): SList<T>;
207
- /**判断数组是否为空
208
- * @returns {boolean} - 是否为空
209
- */
210
- isEmpty(): boolean;
211
- /**删除数组中的重复元素
212
- * 改变自身
213
- * @returns {SList<T>} - 自身
214
- */
215
- removeDuplicates(): SList<T>;
216
- /**交集
217
- * @param {SList<T>[]} lists - 数组列表
218
- * @returns {SList<T>} - 新数组
219
- */
220
- intersection(...lists: SList<T>[]): SList<T>;
221
- /**并集
222
- * @param {SList<T>[]} lists - 数组列表
223
- * @returns {SList<T>} - 新数组
224
- */
225
- union(...lists: SList<T>[]): SList<T>;
226
- /**返回符合条件的成员组成的新数组
227
- * @param {FiltCallback<T>} func - 条件函数
228
- * @returns {SList<T>} - 新数组
229
- */
230
- filt(func: FiltCallback<T>): SList<T>;
231
- /**遍历数组的每一个元素
232
- * @param {EachCallback<T>} func - 遍历函数 (value: T, index: number, list: SList<T>): void
233
- * @returns {SList<T>} - 自身
234
- */
235
- each(func: EachCallback<T>): SList<T>;
236
- /**对数组的每一个元素进行加工,返回加工完成的成员组成的新数组
237
- * @param {MapCallback<T,O>} func - 加工函数 (value: T, index: number, list: SList<T>): O
238
- * @returns {SList<O>} - 新数组
239
- */
240
- map<O>(func: MapCallback<T, O>): SList<O>;
241
- /**对数组进行排序
242
- * 如函数返回值大于 0 则将 x 排在 y 后面,小于 0 则将 x 排在 y 前面
243
- * 改变自身
244
- * @param {SortCallback<T>} func - 排序函数 (a: T, b: T): number
245
- * @returns {SList<T>} - 自身
246
- */
247
- sort(func: SortCallback<T>): SList<T>;
248
- /**对数组进行统计 aggregate
249
- * 遍历数组,并将每次遍历的结果与下一次遍历的元素一起传入函数,最后返回最后一次遍历的结果
250
- * @param {O} init - 初始值
251
- * @param {AggrCallback<T,O>} func - 统计函数 (value: T, accumulator: U, index: number, list: SList<T>): U
252
- * @returns {O} - 统计结果
253
- */
254
- aggr<O>(init: O, func: AggrCallback<T, O>): O;
255
- /**对数组进行缩减
256
- * 遍历数组,并将每次遍历的结果与下一次遍历的元素一起传入函数,最后返回最后一次遍历的结果
257
- * @param {ReduceCallback<T>} func - 缩减函数 (previousValue: T, currentValue: T, currentIndex: number, array: SList<T>):T
258
- * @param {T} init - 初始值
259
- * @returns {T} - 缩减结果
260
- */
261
- reduce(func: ReduceCallback<T>, init?: T): T | null;
262
- [Symbol.iterator](): {
263
- next(): {
264
- value: T | null;
265
- done: boolean;
266
- };
267
- };
268
- }
269
- interface SStreamOperation<T, U> {
270
- (item: T): Promise<U>;
271
- }
272
- export declare class SStream<T> {
273
- /**并发数*/
274
- private _concurrent;
275
- /**原始列表*/
276
- private _slist;
277
- /**加工函数列表*/
278
- private _operation;
279
- constructor(slist: SList<T> | Array<T>, concurrent?: number);
280
- /**映射加工
281
- * @param {SStreamOperation<T,U>} operation - 加工函数
282
- * @returns {SStream<U>} - 新流
283
- */
284
- map<U>(operation: SStreamOperation<T, U>): SStream<U>;
285
- /**遍历
286
- * 返回自身
287
- * @param {SStreamOperation<T,void>} operation - 遍历函数
288
- * @returns {SStream<T>} - 自身
289
- */
290
- each(operation: SStreamOperation<T, void>): SStream<T>;
291
- /**应用加工
292
- * @returns {SStream<T>} - 自身
293
- */
294
- appendOperations(): Promise<SStream<T>>;
295
- /**转换为SList
296
- * @returns {SList<T>} - 数组
297
- */
298
- toSList(): Promise<SList<T>>;
299
- /**转换为数组
300
- * @returns {Array<T>} - 数组
301
- */
302
- toArray(): Promise<Array<T>>;
303
- }
304
- export declare class SIterator<T> {
305
- private _index;
306
- private _list;
307
- constructor(list: SList<T>);
308
- /**判断还有没有下一个元素
309
- * @returns {boolean} - 是否有下一个元素
310
- */
311
- hasNext(): boolean;
312
- /**判断当前下标有无元素
313
- * @returns {boolean} - 是否有当前元素
314
- */
315
- hasCurr(): boolean;
316
- /**判断还有没有上一个元素
317
- * @returns {boolean} - 是否有上一个元素
318
- */
319
- hasPre(): boolean;
320
- /**返回下一个下标指向的数组内成员,然后下标自加1
321
- * @returns {T} - 下一个成员
322
- */
323
- next(): T;
324
- /**返回上一个下标指向的数组内成员,然后下标自减1
325
- * @returns {T} - 上一个成员
326
- */
327
- pre(): T;
328
- /**返回当前下标指向的数组内成员
329
- * @returns {T} - 当前成员
330
- */
331
- curr(): T;
332
- /**返回遍历长度
333
- * @returns {number} - 遍历长度
334
- */
335
- size(): number;
336
- /**获取下个下标
337
- * @returns {number} - 下个下标
338
- */
339
- nextIndex(): number;
340
- /**获取当前下标
341
- * @return {number} - 当前下标
342
- */
343
- currIndex(): number;
344
- /**获取上个下标
345
- * @returns {number} - 上个下标
346
- */
347
- preIndex(): number;
348
- /**判断是否是最后一个
349
- * @returns {boolean} - 是否是最后一个
350
- */
351
- isLast(): boolean;
352
- /**设置数组在迭代器当前下标中的内容
353
- * 返回自身
354
- * @param {T} val 要设置的内容
355
- * @returns {void}
356
- */
357
- set(val: T): SIterator<T>;
358
- /**删除数组在当前下标的内容,然后将下标移至上一位,改变数组长度
359
- * @returns {T} - 被删除的内容
360
- */
361
- remove(): T;
362
- /**在当前下标前插入元素,然后将下标移至原元素,即下一位,改变数组长度
363
- * 返回自身
364
- * @param {T} obj - 要插入的元素
365
- * @returns {SIterator<T>} - 自身
366
- */
367
- addPre(obj: T): SIterator<T>;
368
- /**在当前下标后插入元素,然后将下标移至新元素,即下一位,改变数组长度
369
- * 返回自身
370
- * @param {T} obj - 要插入的元素
371
- * @returns {SIterator<T>} - 自身
372
- */
373
- addNext(obj: T): SIterator<T>;
374
- }
375
- export declare class SEntry<K, V> {
376
- private _key;
377
- private _value;
378
- constructor(key: K, value: V);
379
- getKey(): K;
380
- getValue(): V;
381
- get key(): K;
382
- get value(): V;
383
- }
384
- export declare class SHashMap<K, V> {
385
- private _map;
386
- /**构造函数
387
- * @param {Map<K, V>} [map] - 一个键值对集合
388
- */
389
- constructor(map?: Map<K, V>);
390
- /**添加一个键值对
391
- * 返回自身
392
- * @param {SEntry<K, V>} entry - 键值对
393
- * @returns {SHashMap<K, V>} - 自身
394
- */
395
- putEntry(entry: SEntry<K, V>): SHashMap<K, V>;
396
- /**获取指定键的值
397
- * @param {K} key - 键
398
- * @returns {V | undefined} - 值
399
- */
400
- get(key: K): V | undefined;
401
- /**添加一个键值对
402
- * 返回自身
403
- * @param {K} key - 键
404
- * @param {V} value - 值
405
- * @returns {SHashMap<K, V>} - 自身
406
- */
407
- put(key: K, value: V): SHashMap<K, V>;
408
- /**判断是否存在指定键
409
- * @param {K} key - 键
410
- * @returns {boolean} - 是否存在
411
- */
412
- has(key: K): boolean;
413
- /**获取所有键值对
414
- * @returns {SList<SEntry<K, V>>} - 键值对列表
415
- */
416
- entrys(): SList<SEntry<K, V>>;
417
- /**获取所有键
418
- * @returns {SList<K>} - 键列表
419
- */
420
- keys(): SList<K>;
421
- /**获取所有值
422
- * @returns {SList<V>} - 值列表
423
- */
424
- values(): SList<V>;
425
- /**转换为entry数组,并获取迭代器
426
- * @returns {SIterator<SEntry<K, V>>} - 迭代器
427
- */
428
- iterator(): SIterator<SEntry<K, V>>;
429
- /**删除指定键的键值对
430
- * @param {K} key - 键
431
- * @returns {V | undefined} - 被删除的值
432
- */
433
- remove(key: K): V | undefined;
434
- /**清空哈希表
435
- * @returns {SHashMap<K, V>} - 自身
436
- */
437
- clear(): SHashMap<K, V>;
438
- /**判断哈希表是否为空
439
- * @returns {boolean} - 是否为空
440
- */
441
- isEmpty(): boolean;
442
- /**判断是否存在指定值
443
- * @param {V} val - 值
444
- * @returns {boolean} - 是否存在
445
- */
446
- containsValue(val: V): boolean;
447
- /**判断是否存在指定键
448
- * @param {K} key - 键
449
- * @returns {boolean} - 是否存在
450
- */
451
- containsKey(key: K): boolean;
452
- /**加载指定键的值,若不存在则添加默认值
453
- * 返回键值
454
- * @param {K} key - 键
455
- * @param {V} def - 默认值
456
- * @returns {V} - 值
457
- */
458
- load(key: K, def: V): V;
459
- /**合并另一个哈希表,可选择是否覆盖已有键值对
460
- * @param {SHashMap<K, V>} nmap - 另一个哈希表
461
- * @param {boolean} [isCover=true] - 是否覆盖已有键值对,默认为 true
462
- * @returns {SHashMap<K, V>} - 自身
463
- */
464
- merge(nmap: SHashMap<K, V>, isCover?: boolean): SHashMap<K, V>;
465
- /**获取哈希表大小(键的数量)
466
- * @returns {number} - 大小
467
- */
468
- size(): number;
469
- /**对哈希表的每一个键值对进行加工,返回加工完成的键值对组成的新哈希表
470
- * @param {MapCallback<SEntry<K, V>, SEntry<OK, OV>>} func - 加工函数
471
- * @returns {SHashMap<OK, OV>} - 新哈希表
472
- */
473
- map<OK, OV>(func: MapCallback<SEntry<K, V>, SEntry<OK, OV>>): SHashMap<OK, OV>;
474
- /**返回符合条件的键值对组成的新哈希表
475
- * @param {FiltCallback<SEntry<K, V>>): boolean} func - 条件函数
476
- * @returns {SHashMap<K, V>} - 新哈希表
477
- */
478
- filt(func: FiltCallback<SEntry<K, V>>): SHashMap<K, V>;
479
- /**遍历哈希表的每一个键值对
480
- * @param {EachCallback<SEntry<K, V>>} func - 遍历函数
481
- * @returns {SHashMap<K, V>} - 自身
482
- */
483
- each(func: EachCallback<SEntry<K, V>>): SHashMap<K, V>;
484
- /**对哈希表进行统计
485
- * @param {O} init - 初始值
486
- * @param {AggrCallback<SEntry<K, V>,O>} func - 统计函数
487
- * @returns {O} - 统计结果
488
- */
489
- aggr<O>(init: O, func: AggrCallback<SEntry<K, V>, O>): O;
490
- /**对哈希表进行缩减
491
- * @param {AggrCallback<SEntry<K, V>,V>} func - 缩减函数
492
- * @param {V} init - 初始值
493
- * @returns {V} - 缩减结果
494
- */
495
- reduce(func: AggrCallback<SEntry<K, V>, V>, init?: V): V | null;
496
- [Symbol.iterator](): {
497
- next(): {
498
- value: SEntry<K, V> | null;
499
- done: boolean;
500
- };
501
- };
502
- }
503
1
  /**函数组合器 */
504
2
  export declare class Composer<Result, PreArg = Result> {
505
3
  /**组合函数列表 */
@@ -536,4 +34,40 @@ export declare class Piper<Arg, Result = Arg> {
536
34
  /**直接调用 */
537
35
  invoke(arg: Arg): Result;
538
36
  }
37
+ type StreamOperation<T, U> = (item: T) => Promise<U> | U;
38
+ /**并行流 */
39
+ export declare class Stream<T> {
40
+ /**并发数*/
41
+ private _concurrent;
42
+ /**原始列表*/
43
+ private _list;
44
+ /**加工函数列表*/
45
+ private _operation;
46
+ constructor(list: Array<T>, concurrent?: number);
47
+ /**平分数组
48
+ * @param count - 份数
49
+ * @param mode - 模式 average:轮询平均分 chunk:切块均分
50
+ * @returns 新数组
51
+ */
52
+ private divide;
53
+ /**映射加工
54
+ * @param operation - 加工函数
55
+ * @returns 新流
56
+ */
57
+ map<U>(operation: StreamOperation<T, U>): Stream<U>;
58
+ /**遍历
59
+ * 返回自身
60
+ * @param operation - 遍历函数
61
+ * @returns 自身
62
+ */
63
+ each(operation: StreamOperation<T, void>): Stream<T>;
64
+ /**应用加工
65
+ * @returns 自身
66
+ */
67
+ append(): Promise<Stream<T>>;
68
+ /**转换为数组
69
+ * @returns 数组
70
+ */
71
+ toArray(): Promise<Array<T>>;
72
+ }
539
73
  export {};