@blackglory/structures 0.2.3 → 0.2.7
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/CHANGELOG.md +24 -0
- package/README.md +41 -11
- package/dist/es2015/index.min.mjs +2 -2
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +673 -273
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +677 -274
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +2 -3
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +2 -2
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +673 -273
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +677 -274
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +2 -3
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/box.d.ts +6 -0
- package/lib/es2015/box.js +30 -0
- package/lib/es2015/box.js.map +1 -0
- package/lib/es2015/expirable-map.d.ts +18 -0
- package/lib/es2015/expirable-map.js +109 -0
- package/lib/es2015/expirable-map.js.map +1 -0
- package/lib/es2015/index.d.ts +3 -0
- package/lib/es2015/index.js +3 -0
- package/lib/es2015/index.js.map +1 -1
- package/lib/es2015/lru-map.js +4 -3
- package/lib/es2015/lru-map.js.map +1 -1
- package/lib/es2015/tlru-map.d.ts +21 -0
- package/lib/es2015/tlru-map.js +138 -0
- package/lib/es2015/tlru-map.js.map +1 -0
- package/lib/es2015/trie-map.js +1 -1
- package/lib/es2015/trie-map.js.map +1 -1
- package/lib/es2018/box.d.ts +6 -0
- package/lib/es2018/box.js +30 -0
- package/lib/es2018/box.js.map +1 -0
- package/lib/es2018/expirable-map.d.ts +18 -0
- package/lib/es2018/expirable-map.js +109 -0
- package/lib/es2018/expirable-map.js.map +1 -0
- package/lib/es2018/index.d.ts +3 -0
- package/lib/es2018/index.js +3 -0
- package/lib/es2018/index.js.map +1 -1
- package/lib/es2018/lru-map.js +4 -3
- package/lib/es2018/lru-map.js.map +1 -1
- package/lib/es2018/tlru-map.d.ts +21 -0
- package/lib/es2018/tlru-map.js +138 -0
- package/lib/es2018/tlru-map.js.map +1 -0
- package/lib/es2018/trie-map.js +1 -1
- package/lib/es2018/trie-map.js.map +1 -1
- package/package.json +25 -23
package/dist/es2015/index.umd.js
CHANGED
|
@@ -2,16 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Structures = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function convertConsToArray([value, next]) {
|
|
8
|
-
if (next === null)
|
|
9
|
-
return [value];
|
|
10
|
-
return [value, ...convertConsToArray(next)];
|
|
11
|
-
}
|
|
12
|
-
function convertArrayToCons([value, ...next]) {
|
|
13
|
-
return [value, next.length ? convertArrayToCons(next) : null];
|
|
14
|
-
}
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
15
6
|
|
|
16
7
|
/*! *****************************************************************************
|
|
17
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -41,6 +32,30 @@
|
|
|
41
32
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
42
33
|
}
|
|
43
34
|
|
|
35
|
+
var _Box_value;
|
|
36
|
+
class Box {
|
|
37
|
+
constructor(value) {
|
|
38
|
+
_Box_value.set(this, void 0);
|
|
39
|
+
__classPrivateFieldSet(this, _Box_value, value, "f");
|
|
40
|
+
}
|
|
41
|
+
set(value) {
|
|
42
|
+
__classPrivateFieldSet(this, _Box_value, value, "f");
|
|
43
|
+
}
|
|
44
|
+
get() {
|
|
45
|
+
return __classPrivateFieldGet(this, _Box_value, "f");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
_Box_value = new WeakMap();
|
|
49
|
+
|
|
50
|
+
function convertConsToArray([value, next]) {
|
|
51
|
+
if (next === null)
|
|
52
|
+
return [value];
|
|
53
|
+
return [value, ...convertConsToArray(next)];
|
|
54
|
+
}
|
|
55
|
+
function convertArrayToCons([value, ...next]) {
|
|
56
|
+
return [value, next.length ? convertArrayToCons(next) : null];
|
|
57
|
+
}
|
|
58
|
+
|
|
44
59
|
var _Emitter_map;
|
|
45
60
|
class Emitter {
|
|
46
61
|
constructor() {
|
|
@@ -169,7 +184,7 @@
|
|
|
169
184
|
|
|
170
185
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
171
186
|
|
|
172
|
-
var es2018$
|
|
187
|
+
var es2018$5 = {};
|
|
173
188
|
|
|
174
189
|
var customError = {};
|
|
175
190
|
|
|
@@ -247,73 +262,15 @@
|
|
|
247
262
|
__exportStar(refute$1, exports);
|
|
248
263
|
__exportStar(assert$1, exports);
|
|
249
264
|
|
|
250
|
-
}(es2018$
|
|
265
|
+
}(es2018$5));
|
|
251
266
|
|
|
252
|
-
var
|
|
253
|
-
class LRUMap {
|
|
254
|
-
constructor(limit) {
|
|
255
|
-
_LRUMap_limit.set(this, void 0);
|
|
256
|
-
_LRUMap_map.set(this, new Map());
|
|
257
|
-
es2018$3.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
|
|
258
|
-
es2018$3.assert(limit > 0, 'The parameter limit must be a positive value');
|
|
259
|
-
__classPrivateFieldSet(this, _LRUMap_limit, limit, "f");
|
|
260
|
-
}
|
|
261
|
-
get [(_LRUMap_limit = new WeakMap(), _LRUMap_map = new WeakMap(), Symbol.toStringTag)]() {
|
|
262
|
-
return this.constructor.name;
|
|
263
|
-
}
|
|
264
|
-
get size() {
|
|
265
|
-
return __classPrivateFieldGet(this, _LRUMap_map, "f").size;
|
|
266
|
-
}
|
|
267
|
-
set(key, value) {
|
|
268
|
-
if (__classPrivateFieldGet(this, _LRUMap_map, "f").has(key)) {
|
|
269
|
-
this.updateItem(key, value);
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
if (__classPrivateFieldGet(this, _LRUMap_map, "f").size === __classPrivateFieldGet(this, _LRUMap_limit, "f")) {
|
|
273
|
-
__classPrivateFieldGet(this, _LRUMap_map, "f").delete(this.getColdestKey());
|
|
274
|
-
}
|
|
275
|
-
__classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
|
|
276
|
-
}
|
|
277
|
-
return this;
|
|
278
|
-
}
|
|
279
|
-
has(key) {
|
|
280
|
-
return __classPrivateFieldGet(this, _LRUMap_map, "f").has(key);
|
|
281
|
-
}
|
|
282
|
-
get(key) {
|
|
283
|
-
if (!this.has(key))
|
|
284
|
-
return undefined;
|
|
285
|
-
const value = __classPrivateFieldGet(this, _LRUMap_map, "f").get(key);
|
|
286
|
-
this.updateItem(key, value);
|
|
287
|
-
return value;
|
|
288
|
-
}
|
|
289
|
-
delete(key) {
|
|
290
|
-
return __classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
|
|
291
|
-
}
|
|
292
|
-
clear() {
|
|
293
|
-
__classPrivateFieldGet(this, _LRUMap_map, "f").clear();
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Reinsert the item.
|
|
297
|
-
*/
|
|
298
|
-
updateItem(key, value) {
|
|
299
|
-
__classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
|
|
300
|
-
__classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Return the earliest key inserted in the Map
|
|
304
|
-
*/
|
|
305
|
-
getColdestKey() {
|
|
306
|
-
return __classPrivateFieldGet(this, _LRUMap_map, "f").keys().next().value;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
var es2018$2 = {};
|
|
267
|
+
var es2018$4 = {};
|
|
311
268
|
|
|
312
269
|
var middleware = {};
|
|
313
270
|
|
|
314
271
|
var chunkAsync$1 = {};
|
|
315
272
|
|
|
316
|
-
var es2018$
|
|
273
|
+
var es2018$3 = {};
|
|
317
274
|
|
|
318
275
|
var go$1 = {};
|
|
319
276
|
|
|
@@ -335,15 +292,15 @@
|
|
|
335
292
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
336
293
|
};__exportStar(go$1, exports);
|
|
337
294
|
|
|
338
|
-
}(es2018$
|
|
295
|
+
}(es2018$3));
|
|
339
296
|
|
|
340
297
|
chunkAsync$1.chunkAsync = void 0;
|
|
341
|
-
const go_1$f = es2018$
|
|
342
|
-
const errors_1$f = es2018$
|
|
298
|
+
const go_1$f = es2018$3;
|
|
299
|
+
const errors_1$f = es2018$5;
|
|
343
300
|
function chunkAsync(iterable, size) {
|
|
344
|
-
errors_1$f.assert(Number.isInteger(size), 'The parameter size must be an integer');
|
|
345
|
-
errors_1$f.assert(size > 0, 'The parameter size must be greater than 0');
|
|
346
|
-
return go_1$f.go(async function* () {
|
|
301
|
+
(0, errors_1$f.assert)(Number.isInteger(size), 'The parameter size must be an integer');
|
|
302
|
+
(0, errors_1$f.assert)(size > 0, 'The parameter size must be greater than 0');
|
|
303
|
+
return (0, go_1$f.go)(async function* () {
|
|
347
304
|
let buffer = [];
|
|
348
305
|
for await (const element of iterable) {
|
|
349
306
|
buffer.push(element);
|
|
@@ -360,7 +317,7 @@
|
|
|
360
317
|
|
|
361
318
|
var chunkByAsync$1 = {};
|
|
362
319
|
|
|
363
|
-
var es2018 = {};
|
|
320
|
+
var es2018$2 = {};
|
|
364
321
|
|
|
365
322
|
var array = {};
|
|
366
323
|
|
|
@@ -412,8 +369,8 @@
|
|
|
412
369
|
const null_1$1 = _null;
|
|
413
370
|
const undefined_1$2 = _undefined;
|
|
414
371
|
function isAsyncIterable(val) {
|
|
415
|
-
return null_1$1.isntNull(val)
|
|
416
|
-
&& undefined_1$2.isntUndefined(val)
|
|
372
|
+
return (0, null_1$1.isntNull)(val)
|
|
373
|
+
&& (0, undefined_1$2.isntUndefined)(val)
|
|
417
374
|
&& typeof val[Symbol.asyncIterator] === 'function';
|
|
418
375
|
}
|
|
419
376
|
asyncIterable.isAsyncIterable = isAsyncIterable;
|
|
@@ -450,36 +407,20 @@
|
|
|
450
407
|
|
|
451
408
|
var string = {};
|
|
452
409
|
|
|
453
|
-
string.
|
|
410
|
+
string.isntString = string.isString = void 0;
|
|
454
411
|
function isString(val) {
|
|
455
|
-
return
|
|
412
|
+
return typeof val === 'string';
|
|
456
413
|
}
|
|
457
414
|
string.isString = isString;
|
|
458
415
|
function isntString(val) {
|
|
459
416
|
return !isString(val);
|
|
460
417
|
}
|
|
461
418
|
string.isntString = isntString;
|
|
462
|
-
function isStringPrimitive(val) {
|
|
463
|
-
return typeof val === 'string';
|
|
464
|
-
}
|
|
465
|
-
string.isStringPrimitive = isStringPrimitive;
|
|
466
|
-
function isntStringPrimitive(val) {
|
|
467
|
-
return !isStringPrimitive(val);
|
|
468
|
-
}
|
|
469
|
-
string.isntStringPrimitive = isntStringPrimitive;
|
|
470
|
-
function isStringObject(val) {
|
|
471
|
-
return typeof val === 'object' && val instanceof String;
|
|
472
|
-
}
|
|
473
|
-
string.isStringObject = isStringObject;
|
|
474
|
-
function isntStringObject(val) {
|
|
475
|
-
return !isStringObject(val);
|
|
476
|
-
}
|
|
477
|
-
string.isntStringObject = isntStringObject;
|
|
478
419
|
|
|
479
|
-
char.
|
|
420
|
+
char.isntChar = char.isChar = void 0;
|
|
480
421
|
const string_1$1 = string;
|
|
481
422
|
function isChar(val) {
|
|
482
|
-
return (string_1$1.isString
|
|
423
|
+
return (0, string_1$1.isString)(val)
|
|
483
424
|
&& val.length === 1;
|
|
484
425
|
}
|
|
485
426
|
char.isChar = isChar;
|
|
@@ -487,24 +428,6 @@
|
|
|
487
428
|
return !isChar(val);
|
|
488
429
|
}
|
|
489
430
|
char.isntChar = isntChar;
|
|
490
|
-
function isCharPrimitive(val) {
|
|
491
|
-
return string_1$1.isString(val)
|
|
492
|
-
&& val.length === 1;
|
|
493
|
-
}
|
|
494
|
-
char.isCharPrimitive = isCharPrimitive;
|
|
495
|
-
function isntCharPrimitive(val) {
|
|
496
|
-
return !isCharPrimitive(val);
|
|
497
|
-
}
|
|
498
|
-
char.isntCharPrimitive = isntCharPrimitive;
|
|
499
|
-
function isCharObject(val) {
|
|
500
|
-
return string_1$1.isStringObject(val)
|
|
501
|
-
&& val.length === 1;
|
|
502
|
-
}
|
|
503
|
-
char.isCharObject = isCharObject;
|
|
504
|
-
function isntCharObject(val) {
|
|
505
|
-
return !isCharObject(val);
|
|
506
|
-
}
|
|
507
|
-
char.isntCharObject = isntCharObject;
|
|
508
431
|
|
|
509
432
|
var date = {};
|
|
510
433
|
|
|
@@ -526,6 +449,18 @@
|
|
|
526
449
|
}
|
|
527
450
|
_enum.inEnum = inEnum;
|
|
528
451
|
|
|
452
|
+
var error = {};
|
|
453
|
+
|
|
454
|
+
error.isntError = error.isError = void 0;
|
|
455
|
+
function isError(val) {
|
|
456
|
+
return val instanceof Error;
|
|
457
|
+
}
|
|
458
|
+
error.isError = isError;
|
|
459
|
+
function isntError(val) {
|
|
460
|
+
return !isError(val);
|
|
461
|
+
}
|
|
462
|
+
error.isntError = isntError;
|
|
463
|
+
|
|
529
464
|
var falsy = {};
|
|
530
465
|
|
|
531
466
|
falsy.isntFalsy = falsy.isFalsy = void 0;
|
|
@@ -556,8 +491,8 @@
|
|
|
556
491
|
const null_1 = _null;
|
|
557
492
|
const undefined_1$1 = _undefined;
|
|
558
493
|
function isIterable(val) {
|
|
559
|
-
return null_1.isntNull(val)
|
|
560
|
-
&& undefined_1$1.isntUndefined(val)
|
|
494
|
+
return (0, null_1.isntNull)(val)
|
|
495
|
+
&& (0, undefined_1$1.isntUndefined)(val)
|
|
561
496
|
&& typeof val[Symbol.iterator] === 'function';
|
|
562
497
|
}
|
|
563
498
|
iterable.isIterable = isIterable;
|
|
@@ -611,16 +546,16 @@
|
|
|
611
546
|
const number_1 = number;
|
|
612
547
|
const undefined_1 = _undefined;
|
|
613
548
|
function isJsonRpcId(val) {
|
|
614
|
-
return string_1.isString(val) || number_1.isNumber(val);
|
|
549
|
+
return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
|
|
615
550
|
}
|
|
616
551
|
function isJsonRpcParams(val) {
|
|
617
|
-
return array_1.isArray(val) || object_1.isObject(val);
|
|
552
|
+
return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
|
|
618
553
|
}
|
|
619
554
|
function isJsonRpcNotification(val) {
|
|
620
|
-
return object_1.isRecord(val)
|
|
621
|
-
&& string_1.isString(val.jsonrpc)
|
|
622
|
-
&& string_1.isString(val.method)
|
|
623
|
-
&& undefined_1.isUndefined(val.id)
|
|
555
|
+
return (0, object_1.isRecord)(val)
|
|
556
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
557
|
+
&& (0, string_1.isString)(val.method)
|
|
558
|
+
&& (0, undefined_1.isUndefined)(val.id)
|
|
624
559
|
&& isJsonRpcParams(val.params);
|
|
625
560
|
}
|
|
626
561
|
jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
|
|
@@ -629,9 +564,9 @@
|
|
|
629
564
|
}
|
|
630
565
|
jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
|
|
631
566
|
function isJsonRpcRequest(val) {
|
|
632
|
-
return object_1.isRecord(val)
|
|
633
|
-
&& string_1.isString(val.jsonrpc)
|
|
634
|
-
&& string_1.isString(val.method)
|
|
567
|
+
return (0, object_1.isRecord)(val)
|
|
568
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
569
|
+
&& (0, string_1.isString)(val.method)
|
|
635
570
|
&& isJsonRpcId(val.id)
|
|
636
571
|
&& isJsonRpcParams(val.params);
|
|
637
572
|
}
|
|
@@ -641,10 +576,10 @@
|
|
|
641
576
|
}
|
|
642
577
|
jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
|
|
643
578
|
function isJsonRpcSuccess(val) {
|
|
644
|
-
return object_1.isRecord(val)
|
|
645
|
-
&& string_1.isString(val.jsonrpc)
|
|
646
|
-
&& string_1.isString(val.id)
|
|
647
|
-
&& undefined_1.isntUndefined(val.result);
|
|
579
|
+
return (0, object_1.isRecord)(val)
|
|
580
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
581
|
+
&& (0, string_1.isString)(val.id)
|
|
582
|
+
&& (0, undefined_1.isntUndefined)(val.result);
|
|
648
583
|
}
|
|
649
584
|
jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
|
|
650
585
|
function isntJsonRpcSuccess(val) {
|
|
@@ -652,8 +587,8 @@
|
|
|
652
587
|
}
|
|
653
588
|
jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
|
|
654
589
|
function isJsonRpcError(val) {
|
|
655
|
-
return object_1.isRecord(val)
|
|
656
|
-
&& string_1.isString(val.jsonrpc)
|
|
590
|
+
return (0, object_1.isRecord)(val)
|
|
591
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
657
592
|
&& isJsonRpcId(val.id)
|
|
658
593
|
&& isJsonRpcErrorObject(val.error);
|
|
659
594
|
}
|
|
@@ -663,10 +598,10 @@
|
|
|
663
598
|
}
|
|
664
599
|
jsonRpc.isntJsonRpcError = isntJsonRpcError;
|
|
665
600
|
function isJsonRpcErrorObject(val) {
|
|
666
|
-
return object_1.isRecord(val)
|
|
667
|
-
&& number_1.isNumber(val.code)
|
|
668
|
-
&& string_1.isString(val.message)
|
|
669
|
-
&& (undefined_1.isUndefined(val.data) || object_1.isObject(val.data));
|
|
601
|
+
return (0, object_1.isRecord)(val)
|
|
602
|
+
&& (0, number_1.isNumber)(val.code)
|
|
603
|
+
&& (0, string_1.isString)(val.message)
|
|
604
|
+
&& ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
|
|
670
605
|
}
|
|
671
606
|
|
|
672
607
|
var json = {};
|
|
@@ -718,6 +653,7 @@
|
|
|
718
653
|
__exportStar(char, exports);
|
|
719
654
|
__exportStar(date, exports);
|
|
720
655
|
__exportStar(_enum, exports);
|
|
656
|
+
__exportStar(error, exports);
|
|
721
657
|
__exportStar(falsy, exports);
|
|
722
658
|
__exportStar(_function, exports);
|
|
723
659
|
__exportStar(iterable, exports);
|
|
@@ -730,12 +666,12 @@
|
|
|
730
666
|
__exportStar(_undefined, exports);
|
|
731
667
|
__exportStar(url, exports);
|
|
732
668
|
|
|
733
|
-
}(es2018));
|
|
669
|
+
}(es2018$2));
|
|
734
670
|
|
|
735
671
|
chunkByAsync$1.chunkByAsync = void 0;
|
|
736
|
-
const types_1$h = es2018;
|
|
672
|
+
const types_1$h = es2018$2;
|
|
737
673
|
function chunkByAsync(iterable, predicate) {
|
|
738
|
-
if (types_1$h.isAsyncIterable(iterable)) {
|
|
674
|
+
if ((0, types_1$h.isAsyncIterable)(iterable)) {
|
|
739
675
|
return chunkByAsyncIterable(iterable);
|
|
740
676
|
}
|
|
741
677
|
else {
|
|
@@ -794,12 +730,12 @@
|
|
|
794
730
|
var chunk$1 = {};
|
|
795
731
|
|
|
796
732
|
chunk$1.chunk = void 0;
|
|
797
|
-
const go_1$e = es2018$
|
|
798
|
-
const errors_1$e = es2018$
|
|
733
|
+
const go_1$e = es2018$3;
|
|
734
|
+
const errors_1$e = es2018$5;
|
|
799
735
|
function chunk(iterable, size) {
|
|
800
|
-
errors_1$e.assert(Number.isInteger(size), 'The parameter size must be an integer');
|
|
801
|
-
errors_1$e.assert(size > 0, 'The parameter size must be greater than 0');
|
|
802
|
-
return go_1$e.go(function* () {
|
|
736
|
+
(0, errors_1$e.assert)(Number.isInteger(size), 'The parameter size must be an integer');
|
|
737
|
+
(0, errors_1$e.assert)(size > 0, 'The parameter size must be greater than 0');
|
|
738
|
+
return (0, go_1$e.go)(function* () {
|
|
803
739
|
let buffer = [];
|
|
804
740
|
for (const element of iterable) {
|
|
805
741
|
buffer.push(element);
|
|
@@ -817,12 +753,12 @@
|
|
|
817
753
|
var concatAsync$1 = {};
|
|
818
754
|
|
|
819
755
|
concatAsync$1.concatAsync = void 0;
|
|
820
|
-
const types_1$g = es2018;
|
|
821
|
-
const go_1$d = es2018$
|
|
756
|
+
const types_1$g = es2018$2;
|
|
757
|
+
const go_1$d = es2018$3;
|
|
822
758
|
function concatAsync(iterable, ...otherIterables) {
|
|
823
|
-
return go_1$d.go(async function* () {
|
|
759
|
+
return (0, go_1$d.go)(async function* () {
|
|
824
760
|
for (const iter of [iterable, ...otherIterables]) {
|
|
825
|
-
if (types_1$g.isAsyncIterable(iter)) {
|
|
761
|
+
if ((0, types_1$g.isAsyncIterable)(iter)) {
|
|
826
762
|
for await (const element of iter) {
|
|
827
763
|
yield element;
|
|
828
764
|
}
|
|
@@ -840,9 +776,9 @@
|
|
|
840
776
|
var concat$1 = {};
|
|
841
777
|
|
|
842
778
|
concat$1.concat = void 0;
|
|
843
|
-
const go_1$c = es2018$
|
|
779
|
+
const go_1$c = es2018$3;
|
|
844
780
|
function concat(iterable, ...otherIterables) {
|
|
845
|
-
return go_1$c.go(function* () {
|
|
781
|
+
return (0, go_1$c.go)(function* () {
|
|
846
782
|
for (const iter of [iterable, ...otherIterables]) {
|
|
847
783
|
yield* iter;
|
|
848
784
|
}
|
|
@@ -869,15 +805,15 @@
|
|
|
869
805
|
utils.copyIterable = copyIterable;
|
|
870
806
|
|
|
871
807
|
dropAsync$1.dropAsync = void 0;
|
|
872
|
-
const go_1$b = es2018$
|
|
808
|
+
const go_1$b = es2018$3;
|
|
873
809
|
const utils_1$3 = utils;
|
|
874
|
-
const errors_1$d = es2018$
|
|
810
|
+
const errors_1$d = es2018$5;
|
|
875
811
|
function dropAsync(iterable, count) {
|
|
876
|
-
errors_1$d.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
877
|
-
errors_1$d.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
812
|
+
(0, errors_1$d.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
813
|
+
(0, errors_1$d.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
878
814
|
if (count === 0)
|
|
879
|
-
return utils_1$3.copyAsyncIterable(iterable);
|
|
880
|
-
return go_1$b.go(async function* () {
|
|
815
|
+
return (0, utils_1$3.copyAsyncIterable)(iterable);
|
|
816
|
+
return (0, go_1$b.go)(async function* () {
|
|
881
817
|
var _a;
|
|
882
818
|
const iterator = iterable[Symbol.asyncIterator]();
|
|
883
819
|
let done;
|
|
@@ -904,15 +840,15 @@
|
|
|
904
840
|
var dropRightAsync$1 = {};
|
|
905
841
|
|
|
906
842
|
dropRightAsync$1.dropRightAsync = void 0;
|
|
907
|
-
const go_1$a = es2018$
|
|
843
|
+
const go_1$a = es2018$3;
|
|
908
844
|
const utils_1$2 = utils;
|
|
909
|
-
const errors_1$c = es2018$
|
|
845
|
+
const errors_1$c = es2018$5;
|
|
910
846
|
function dropRightAsync(iterable, count) {
|
|
911
|
-
errors_1$c.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
912
|
-
errors_1$c.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
847
|
+
(0, errors_1$c.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
848
|
+
(0, errors_1$c.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
913
849
|
if (count === 0)
|
|
914
|
-
return utils_1$2.copyAsyncIterable(iterable);
|
|
915
|
-
return go_1$a.go(async function* () {
|
|
850
|
+
return (0, utils_1$2.copyAsyncIterable)(iterable);
|
|
851
|
+
return (0, go_1$a.go)(async function* () {
|
|
916
852
|
const arr = await toArrayAsync$2(iterable);
|
|
917
853
|
const result = arr.slice(0, -count);
|
|
918
854
|
for (const value of result) {
|
|
@@ -932,15 +868,15 @@
|
|
|
932
868
|
var dropRight$1 = {};
|
|
933
869
|
|
|
934
870
|
dropRight$1.dropRight = void 0;
|
|
935
|
-
const go_1$9 = es2018$
|
|
871
|
+
const go_1$9 = es2018$3;
|
|
936
872
|
const utils_1$1 = utils;
|
|
937
|
-
const errors_1$b = es2018$
|
|
873
|
+
const errors_1$b = es2018$5;
|
|
938
874
|
function dropRight(iterable, count) {
|
|
939
|
-
errors_1$b.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
940
|
-
errors_1$b.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
875
|
+
(0, errors_1$b.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
876
|
+
(0, errors_1$b.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
941
877
|
if (count === 0)
|
|
942
|
-
return utils_1$1.copyIterable(iterable);
|
|
943
|
-
return go_1$9.go(function* () {
|
|
878
|
+
return (0, utils_1$1.copyIterable)(iterable);
|
|
879
|
+
return (0, go_1$9.go)(function* () {
|
|
944
880
|
const arr = Array.from(iterable);
|
|
945
881
|
yield* arr.slice(0, -count);
|
|
946
882
|
});
|
|
@@ -950,9 +886,9 @@
|
|
|
950
886
|
var dropUntilAsync$1 = {};
|
|
951
887
|
|
|
952
888
|
dropUntilAsync$1.dropUntilAsync = void 0;
|
|
953
|
-
const types_1$f = es2018;
|
|
889
|
+
const types_1$f = es2018$2;
|
|
954
890
|
function dropUntilAsync(iterable, predicate) {
|
|
955
|
-
if (types_1$f.isAsyncIterable(iterable)) {
|
|
891
|
+
if ((0, types_1$f.isAsyncIterable)(iterable)) {
|
|
956
892
|
return dropUntilAsyncIterable(iterable);
|
|
957
893
|
}
|
|
958
894
|
else {
|
|
@@ -1032,15 +968,15 @@
|
|
|
1032
968
|
var drop$1 = {};
|
|
1033
969
|
|
|
1034
970
|
drop$1.drop = void 0;
|
|
1035
|
-
const go_1$8 = es2018$
|
|
971
|
+
const go_1$8 = es2018$3;
|
|
1036
972
|
const utils_1 = utils;
|
|
1037
|
-
const errors_1$a = es2018$
|
|
973
|
+
const errors_1$a = es2018$5;
|
|
1038
974
|
function drop(iterable, count) {
|
|
1039
|
-
errors_1$a.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1040
|
-
errors_1$a.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
975
|
+
(0, errors_1$a.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
976
|
+
(0, errors_1$a.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1041
977
|
if (count === 0)
|
|
1042
|
-
return utils_1.copyIterable(iterable);
|
|
1043
|
-
return go_1$8.go(function* () {
|
|
978
|
+
return (0, utils_1.copyIterable)(iterable);
|
|
979
|
+
return (0, go_1$8.go)(function* () {
|
|
1044
980
|
var _a;
|
|
1045
981
|
const iterator = iterable[Symbol.iterator]();
|
|
1046
982
|
let done;
|
|
@@ -1067,9 +1003,9 @@
|
|
|
1067
1003
|
var filterAsync$1 = {};
|
|
1068
1004
|
|
|
1069
1005
|
filterAsync$1.filterAsync = void 0;
|
|
1070
|
-
const types_1$e = es2018;
|
|
1006
|
+
const types_1$e = es2018$2;
|
|
1071
1007
|
function filterAsync(iterable, predicate) {
|
|
1072
|
-
if (types_1$e.isAsyncIterable(iterable)) {
|
|
1008
|
+
if ((0, types_1$e.isAsyncIterable)(iterable)) {
|
|
1073
1009
|
return filterAsyncIterable(iterable);
|
|
1074
1010
|
}
|
|
1075
1011
|
else {
|
|
@@ -1114,9 +1050,9 @@
|
|
|
1114
1050
|
var flattenByAsync$1 = {};
|
|
1115
1051
|
|
|
1116
1052
|
flattenByAsync$1.flattenByAsync = void 0;
|
|
1117
|
-
const types_1$d = es2018;
|
|
1053
|
+
const types_1$d = es2018$2;
|
|
1118
1054
|
function flattenByAsync(iterable, predicate) {
|
|
1119
|
-
if (types_1$d.isAsyncIterable(iterable)) {
|
|
1055
|
+
if ((0, types_1$d.isAsyncIterable)(iterable)) {
|
|
1120
1056
|
return flattenByAsyncIterable(iterable);
|
|
1121
1057
|
}
|
|
1122
1058
|
else {
|
|
@@ -1149,30 +1085,30 @@
|
|
|
1149
1085
|
}
|
|
1150
1086
|
flattenByAsync$1.flattenByAsync = flattenByAsync;
|
|
1151
1087
|
function isFiniteIterable$1(val) {
|
|
1152
|
-
return types_1$d.isIterable(val) && types_1$d.isntChar(val);
|
|
1088
|
+
return (0, types_1$d.isIterable)(val) && (0, types_1$d.isntChar)(val);
|
|
1153
1089
|
}
|
|
1154
1090
|
|
|
1155
1091
|
flattenDeepAsync$1.flattenDeepAsync = void 0;
|
|
1156
1092
|
const flatten_by_async_1 = flattenByAsync$1;
|
|
1157
|
-
const errors_1$9 = es2018$
|
|
1093
|
+
const errors_1$9 = es2018$5;
|
|
1158
1094
|
function flattenDeepAsync(iterable, depth = Infinity) {
|
|
1159
|
-
errors_1$9.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
|
|
1160
|
-
errors_1$9.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
|
|
1161
|
-
return flatten_by_async_1.flattenByAsync(iterable, (_, level) => level <= depth);
|
|
1095
|
+
(0, errors_1$9.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
|
|
1096
|
+
(0, errors_1$9.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
|
|
1097
|
+
return (0, flatten_by_async_1.flattenByAsync)(iterable, (_, level) => level <= depth);
|
|
1162
1098
|
}
|
|
1163
1099
|
flattenDeepAsync$1.flattenDeepAsync = flattenDeepAsync;
|
|
1164
1100
|
|
|
1165
1101
|
flattenAsync$1.flattenAsync = void 0;
|
|
1166
1102
|
const flatten_deep_async_1 = flattenDeepAsync$1;
|
|
1167
1103
|
function flattenAsync(iterable) {
|
|
1168
|
-
return flatten_deep_async_1.flattenDeepAsync(iterable, 1);
|
|
1104
|
+
return (0, flatten_deep_async_1.flattenDeepAsync)(iterable, 1);
|
|
1169
1105
|
}
|
|
1170
1106
|
flattenAsync$1.flattenAsync = flattenAsync;
|
|
1171
1107
|
|
|
1172
1108
|
var flattenBy$1 = {};
|
|
1173
1109
|
|
|
1174
1110
|
flattenBy$1.flattenBy = void 0;
|
|
1175
|
-
const types_1$c = es2018;
|
|
1111
|
+
const types_1$c = es2018$2;
|
|
1176
1112
|
function flattenBy(iterable, predicate) {
|
|
1177
1113
|
return flatten(iterable, 1);
|
|
1178
1114
|
function* flatten(iterable, level) {
|
|
@@ -1188,18 +1124,18 @@
|
|
|
1188
1124
|
}
|
|
1189
1125
|
flattenBy$1.flattenBy = flattenBy;
|
|
1190
1126
|
function isFiniteIterable(val) {
|
|
1191
|
-
return types_1$c.isIterable(val) && types_1$c.isntChar(val);
|
|
1127
|
+
return (0, types_1$c.isIterable)(val) && (0, types_1$c.isntChar)(val);
|
|
1192
1128
|
}
|
|
1193
1129
|
|
|
1194
1130
|
var flattenDeep$1 = {};
|
|
1195
1131
|
|
|
1196
1132
|
flattenDeep$1.flattenDeep = void 0;
|
|
1197
1133
|
const flatten_by_1 = flattenBy$1;
|
|
1198
|
-
const errors_1$8 = es2018$
|
|
1134
|
+
const errors_1$8 = es2018$5;
|
|
1199
1135
|
function flattenDeep(iterable, depth = Infinity) {
|
|
1200
|
-
errors_1$8.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
|
|
1201
|
-
errors_1$8.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
|
|
1202
|
-
return flatten_by_1.flattenBy(iterable, (_, level) => level <= depth);
|
|
1136
|
+
(0, errors_1$8.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
|
|
1137
|
+
(0, errors_1$8.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
|
|
1138
|
+
return (0, flatten_by_1.flattenBy)(iterable, (_, level) => level <= depth);
|
|
1203
1139
|
}
|
|
1204
1140
|
flattenDeep$1.flattenDeep = flattenDeep;
|
|
1205
1141
|
|
|
@@ -1208,16 +1144,16 @@
|
|
|
1208
1144
|
flatten$1.flatten = void 0;
|
|
1209
1145
|
const flatten_deep_1 = flattenDeep$1;
|
|
1210
1146
|
function flatten(iterable) {
|
|
1211
|
-
return flatten_deep_1.flattenDeep(iterable, 1);
|
|
1147
|
+
return (0, flatten_deep_1.flattenDeep)(iterable, 1);
|
|
1212
1148
|
}
|
|
1213
1149
|
flatten$1.flatten = flatten;
|
|
1214
1150
|
|
|
1215
1151
|
var mapAsync$1 = {};
|
|
1216
1152
|
|
|
1217
1153
|
mapAsync$1.mapAsync = void 0;
|
|
1218
|
-
const types_1$b = es2018;
|
|
1154
|
+
const types_1$b = es2018$2;
|
|
1219
1155
|
function mapAsync(iterable, fn) {
|
|
1220
|
-
if (types_1$b.isAsyncIterable(iterable)) {
|
|
1156
|
+
if ((0, types_1$b.isAsyncIterable)(iterable)) {
|
|
1221
1157
|
return mapAsyncIterable(iterable);
|
|
1222
1158
|
}
|
|
1223
1159
|
else {
|
|
@@ -1255,14 +1191,14 @@
|
|
|
1255
1191
|
var repeatAsync$1 = {};
|
|
1256
1192
|
|
|
1257
1193
|
repeatAsync$1.repeatAsync = void 0;
|
|
1258
|
-
const go_1$7 = es2018$
|
|
1259
|
-
const errors_1$7 = es2018$
|
|
1194
|
+
const go_1$7 = es2018$3;
|
|
1195
|
+
const errors_1$7 = es2018$5;
|
|
1260
1196
|
function repeatAsync(iterable, times) {
|
|
1261
|
-
errors_1$7.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
|
|
1262
|
-
errors_1$7.assert(times >= 0, 'The parameter times must be greater than or equal to 0');
|
|
1197
|
+
(0, errors_1$7.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
|
|
1198
|
+
(0, errors_1$7.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
|
|
1263
1199
|
if (times === Infinity)
|
|
1264
1200
|
warnInfiniteLoop$1();
|
|
1265
|
-
return go_1$7.go(async function* () {
|
|
1201
|
+
return (0, go_1$7.go)(async function* () {
|
|
1266
1202
|
const cache = [];
|
|
1267
1203
|
if (times > 0) {
|
|
1268
1204
|
for await (const element of iterable) {
|
|
@@ -1290,14 +1226,14 @@
|
|
|
1290
1226
|
var repeat$1 = {};
|
|
1291
1227
|
|
|
1292
1228
|
repeat$1.repeat = void 0;
|
|
1293
|
-
const go_1$6 = es2018$
|
|
1294
|
-
const errors_1$6 = es2018$
|
|
1229
|
+
const go_1$6 = es2018$3;
|
|
1230
|
+
const errors_1$6 = es2018$5;
|
|
1295
1231
|
function repeat(iterable, times) {
|
|
1296
|
-
errors_1$6.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
|
|
1297
|
-
errors_1$6.assert(times >= 0, 'The parameter times must be greater than or equal to 0');
|
|
1232
|
+
(0, errors_1$6.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
|
|
1233
|
+
(0, errors_1$6.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
|
|
1298
1234
|
if (times === Infinity)
|
|
1299
1235
|
warnInfiniteLoop();
|
|
1300
|
-
return go_1$6.go(function* () {
|
|
1236
|
+
return (0, go_1$6.go)(function* () {
|
|
1301
1237
|
const cache = [];
|
|
1302
1238
|
if (times > 0) {
|
|
1303
1239
|
for (const element of iterable) {
|
|
@@ -1325,14 +1261,14 @@
|
|
|
1325
1261
|
var sliceAsync$1 = {};
|
|
1326
1262
|
|
|
1327
1263
|
sliceAsync$1.sliceAsync = void 0;
|
|
1328
|
-
const go_1$5 = es2018$
|
|
1329
|
-
const errors_1$5 = es2018$
|
|
1264
|
+
const go_1$5 = es2018$3;
|
|
1265
|
+
const errors_1$5 = es2018$5;
|
|
1330
1266
|
function sliceAsync(iterable, start, end = Infinity) {
|
|
1331
|
-
errors_1$5.assert(Number.isInteger(start), 'The parameter start must be an integer');
|
|
1332
|
-
errors_1$5.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
|
|
1333
|
-
errors_1$5.assert(Number.isInteger(end), 'The parameter end must be an integer');
|
|
1334
|
-
errors_1$5.assert(end >= start, 'The parameter end must be greater than or equal to start');
|
|
1335
|
-
return go_1$5.go(async function* () {
|
|
1267
|
+
(0, errors_1$5.assert)(Number.isInteger(start), 'The parameter start must be an integer');
|
|
1268
|
+
(0, errors_1$5.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
|
|
1269
|
+
(0, errors_1$5.assert)(Number.isInteger(end), 'The parameter end must be an integer');
|
|
1270
|
+
(0, errors_1$5.assert)(end >= start, 'The parameter end must be greater than or equal to start');
|
|
1271
|
+
return (0, go_1$5.go)(async function* () {
|
|
1336
1272
|
let index = 0;
|
|
1337
1273
|
for await (const element of iterable) {
|
|
1338
1274
|
if (index >= end)
|
|
@@ -1348,14 +1284,14 @@
|
|
|
1348
1284
|
var slice$1 = {};
|
|
1349
1285
|
|
|
1350
1286
|
slice$1.slice = void 0;
|
|
1351
|
-
const go_1$4 = es2018$
|
|
1352
|
-
const errors_1$4 = es2018$
|
|
1287
|
+
const go_1$4 = es2018$3;
|
|
1288
|
+
const errors_1$4 = es2018$5;
|
|
1353
1289
|
function slice(iterable, start, end = Infinity) {
|
|
1354
|
-
errors_1$4.assert(Number.isInteger(start), 'The parameter start must be an integer');
|
|
1355
|
-
errors_1$4.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
|
|
1356
|
-
errors_1$4.assert(Number.isInteger(end), 'The parameter end must be an integer');
|
|
1357
|
-
errors_1$4.assert(end >= start, 'The parameter end must be greater than or equal to start');
|
|
1358
|
-
return go_1$4.go(function* () {
|
|
1290
|
+
(0, errors_1$4.assert)(Number.isInteger(start), 'The parameter start must be an integer');
|
|
1291
|
+
(0, errors_1$4.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
|
|
1292
|
+
(0, errors_1$4.assert)(Number.isInteger(end), 'The parameter end must be an integer');
|
|
1293
|
+
(0, errors_1$4.assert)(end >= start, 'The parameter end must be greater than or equal to start');
|
|
1294
|
+
return (0, go_1$4.go)(function* () {
|
|
1359
1295
|
let index = 0;
|
|
1360
1296
|
for (const element of iterable) {
|
|
1361
1297
|
if (index >= end)
|
|
@@ -1389,9 +1325,9 @@
|
|
|
1389
1325
|
var splitByAsync$1 = {};
|
|
1390
1326
|
|
|
1391
1327
|
splitByAsync$1.splitByAsync = void 0;
|
|
1392
|
-
const types_1$a = es2018;
|
|
1328
|
+
const types_1$a = es2018$2;
|
|
1393
1329
|
function splitByAsync(iterable, predicate) {
|
|
1394
|
-
if (types_1$a.isAsyncIterable(iterable)) {
|
|
1330
|
+
if ((0, types_1$a.isAsyncIterable)(iterable)) {
|
|
1395
1331
|
return splitByAsyncIterable(iterable);
|
|
1396
1332
|
}
|
|
1397
1333
|
else {
|
|
@@ -1471,12 +1407,12 @@
|
|
|
1471
1407
|
var takeAsync$1 = {};
|
|
1472
1408
|
|
|
1473
1409
|
takeAsync$1.takeAsync = void 0;
|
|
1474
|
-
const go_1$3 = es2018$
|
|
1475
|
-
const errors_1$3 = es2018$
|
|
1410
|
+
const go_1$3 = es2018$3;
|
|
1411
|
+
const errors_1$3 = es2018$5;
|
|
1476
1412
|
function takeAsync(iterable, count) {
|
|
1477
|
-
errors_1$3.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1478
|
-
errors_1$3.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1479
|
-
return go_1$3.go(async function* () {
|
|
1413
|
+
(0, errors_1$3.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1414
|
+
(0, errors_1$3.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1415
|
+
return (0, go_1$3.go)(async function* () {
|
|
1480
1416
|
if (count === 0)
|
|
1481
1417
|
return;
|
|
1482
1418
|
for await (const element of iterable) {
|
|
@@ -1492,12 +1428,12 @@
|
|
|
1492
1428
|
var takeRightAsync$1 = {};
|
|
1493
1429
|
|
|
1494
1430
|
takeRightAsync$1.takeRightAsync = void 0;
|
|
1495
|
-
const go_1$2 = es2018$
|
|
1496
|
-
const errors_1$2 = es2018$
|
|
1431
|
+
const go_1$2 = es2018$3;
|
|
1432
|
+
const errors_1$2 = es2018$5;
|
|
1497
1433
|
function takeRightAsync(iterable, count) {
|
|
1498
|
-
errors_1$2.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1499
|
-
errors_1$2.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1500
|
-
return go_1$2.go(async function* () {
|
|
1434
|
+
(0, errors_1$2.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1435
|
+
(0, errors_1$2.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1436
|
+
return (0, go_1$2.go)(async function* () {
|
|
1501
1437
|
var _a;
|
|
1502
1438
|
const iterator = iterable[Symbol.asyncIterator]();
|
|
1503
1439
|
let done;
|
|
@@ -1522,12 +1458,12 @@
|
|
|
1522
1458
|
var takeRight$1 = {};
|
|
1523
1459
|
|
|
1524
1460
|
takeRight$1.takeRight = void 0;
|
|
1525
|
-
const go_1$1 = es2018$
|
|
1526
|
-
const errors_1$1 = es2018$
|
|
1461
|
+
const go_1$1 = es2018$3;
|
|
1462
|
+
const errors_1$1 = es2018$5;
|
|
1527
1463
|
function takeRight(iterable, count) {
|
|
1528
|
-
errors_1$1.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1529
|
-
errors_1$1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1530
|
-
return go_1$1.go(function* () {
|
|
1464
|
+
(0, errors_1$1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1465
|
+
(0, errors_1$1.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1466
|
+
return (0, go_1$1.go)(function* () {
|
|
1531
1467
|
var _a;
|
|
1532
1468
|
const iterator = iterable[Symbol.iterator]();
|
|
1533
1469
|
let done;
|
|
@@ -1552,9 +1488,9 @@
|
|
|
1552
1488
|
var takeUntilAsync$1 = {};
|
|
1553
1489
|
|
|
1554
1490
|
takeUntilAsync$1.takeUntilAsync = void 0;
|
|
1555
|
-
const types_1$9 = es2018;
|
|
1491
|
+
const types_1$9 = es2018$2;
|
|
1556
1492
|
function takeUntilAsync(iterable, predicate) {
|
|
1557
|
-
if (types_1$9.isAsyncIterable(iterable)) {
|
|
1493
|
+
if ((0, types_1$9.isAsyncIterable)(iterable)) {
|
|
1558
1494
|
return takeUntilAsyncIterable(iterable);
|
|
1559
1495
|
}
|
|
1560
1496
|
else {
|
|
@@ -1598,12 +1534,12 @@
|
|
|
1598
1534
|
var take$1 = {};
|
|
1599
1535
|
|
|
1600
1536
|
take$1.take = void 0;
|
|
1601
|
-
const go_1 = es2018$
|
|
1602
|
-
const errors_1 = es2018$
|
|
1537
|
+
const go_1 = es2018$3;
|
|
1538
|
+
const errors_1 = es2018$5;
|
|
1603
1539
|
function take(iterable, count) {
|
|
1604
|
-
errors_1.assert(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1605
|
-
errors_1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1606
|
-
return go_1.go(function* () {
|
|
1540
|
+
(0, errors_1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
|
|
1541
|
+
(0, errors_1.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
|
|
1542
|
+
return (0, go_1.go)(function* () {
|
|
1607
1543
|
if (count === 0)
|
|
1608
1544
|
return;
|
|
1609
1545
|
for (const element of iterable) {
|
|
@@ -1619,9 +1555,9 @@
|
|
|
1619
1555
|
var tapAsync$1 = {};
|
|
1620
1556
|
|
|
1621
1557
|
tapAsync$1.tapAsync = void 0;
|
|
1622
|
-
const types_1$8 = es2018;
|
|
1558
|
+
const types_1$8 = es2018$2;
|
|
1623
1559
|
function tapAsync(iterable, fn) {
|
|
1624
|
-
if (types_1$8.isAsyncIterable(iterable)) {
|
|
1560
|
+
if ((0, types_1$8.isAsyncIterable)(iterable)) {
|
|
1625
1561
|
return tapAsyncIterable(iterable);
|
|
1626
1562
|
}
|
|
1627
1563
|
else {
|
|
@@ -1702,9 +1638,9 @@
|
|
|
1702
1638
|
var uniqByAsync$1 = {};
|
|
1703
1639
|
|
|
1704
1640
|
uniqByAsync$1.uniqByAsync = void 0;
|
|
1705
|
-
const types_1$7 = es2018;
|
|
1641
|
+
const types_1$7 = es2018$2;
|
|
1706
1642
|
function uniqByAsync(iterable, fn) {
|
|
1707
|
-
if (types_1$7.isAsyncIterable(iterable)) {
|
|
1643
|
+
if ((0, types_1$7.isAsyncIterable)(iterable)) {
|
|
1708
1644
|
return uniqByAsyncIterable(iterable);
|
|
1709
1645
|
}
|
|
1710
1646
|
else {
|
|
@@ -1771,7 +1707,7 @@
|
|
|
1771
1707
|
var zipAsync$1 = {};
|
|
1772
1708
|
|
|
1773
1709
|
zipAsync$1.zipAsync = void 0;
|
|
1774
|
-
const types_1$6 = es2018;
|
|
1710
|
+
const types_1$6 = es2018$2;
|
|
1775
1711
|
var Kind;
|
|
1776
1712
|
(function (Kind) {
|
|
1777
1713
|
Kind[Kind["Sync"] = 0] = "Sync";
|
|
@@ -1785,7 +1721,7 @@
|
|
|
1785
1721
|
var _a, _b, _c, _d;
|
|
1786
1722
|
const length = iterables.length;
|
|
1787
1723
|
const iterators = iterables.map(iterable => {
|
|
1788
|
-
if (types_1$6.isAsyncIterable(iterable)) {
|
|
1724
|
+
if ((0, types_1$6.isAsyncIterable)(iterable)) {
|
|
1789
1725
|
return [Kind.Async, iterable[Symbol.asyncIterator]()];
|
|
1790
1726
|
}
|
|
1791
1727
|
else {
|
|
@@ -1931,9 +1867,9 @@
|
|
|
1931
1867
|
var eachAsync$1 = {};
|
|
1932
1868
|
|
|
1933
1869
|
eachAsync$1.eachAsync = void 0;
|
|
1934
|
-
const types_1$5 = es2018;
|
|
1870
|
+
const types_1$5 = es2018$2;
|
|
1935
1871
|
function eachAsync(iterable, fn) {
|
|
1936
|
-
if (types_1$5.isAsyncIterable(iterable)) {
|
|
1872
|
+
if ((0, types_1$5.isAsyncIterable)(iterable)) {
|
|
1937
1873
|
return eachAsyncIterable(iterable);
|
|
1938
1874
|
}
|
|
1939
1875
|
else {
|
|
@@ -1971,9 +1907,9 @@
|
|
|
1971
1907
|
var everyAsync$1 = {};
|
|
1972
1908
|
|
|
1973
1909
|
everyAsync$1.everyAsync = void 0;
|
|
1974
|
-
const types_1$4 = es2018;
|
|
1910
|
+
const types_1$4 = es2018$2;
|
|
1975
1911
|
function everyAsync(iterable, predicate) {
|
|
1976
|
-
if (types_1$4.isAsyncIterable(iterable)) {
|
|
1912
|
+
if ((0, types_1$4.isAsyncIterable)(iterable)) {
|
|
1977
1913
|
return everyAsyncIterable(iterable);
|
|
1978
1914
|
}
|
|
1979
1915
|
else {
|
|
@@ -2017,9 +1953,9 @@
|
|
|
2017
1953
|
var findAsync$1 = {};
|
|
2018
1954
|
|
|
2019
1955
|
findAsync$1.findAsync = void 0;
|
|
2020
|
-
const types_1$3 = es2018;
|
|
1956
|
+
const types_1$3 = es2018$2;
|
|
2021
1957
|
function findAsync(iterable, predicate) {
|
|
2022
|
-
if (types_1$3.isAsyncIterable(iterable)) {
|
|
1958
|
+
if ((0, types_1$3.isAsyncIterable)(iterable)) {
|
|
2023
1959
|
return findAsyncIterable(iterable);
|
|
2024
1960
|
}
|
|
2025
1961
|
else {
|
|
@@ -2141,9 +2077,9 @@
|
|
|
2141
2077
|
var reduceAsync$1 = {};
|
|
2142
2078
|
|
|
2143
2079
|
reduceAsync$1.reduceAsync = void 0;
|
|
2144
|
-
const types_1$2 = es2018;
|
|
2080
|
+
const types_1$2 = es2018$2;
|
|
2145
2081
|
function reduceAsync(iterable, fn, initialValue) {
|
|
2146
|
-
if (types_1$2.isUndefined(initialValue)) {
|
|
2082
|
+
if ((0, types_1$2.isUndefined)(initialValue)) {
|
|
2147
2083
|
return reduceAsyncWithoutInitialValue(iterable, fn);
|
|
2148
2084
|
}
|
|
2149
2085
|
else {
|
|
@@ -2152,7 +2088,7 @@
|
|
|
2152
2088
|
}
|
|
2153
2089
|
reduceAsync$1.reduceAsync = reduceAsync;
|
|
2154
2090
|
function reduceAsyncWithInitialValue(iterable, fn, initialValue) {
|
|
2155
|
-
if (types_1$2.isAsyncIterable(iterable)) {
|
|
2091
|
+
if ((0, types_1$2.isAsyncIterable)(iterable)) {
|
|
2156
2092
|
return reduceAsyncIterable(iterable);
|
|
2157
2093
|
}
|
|
2158
2094
|
else {
|
|
@@ -2174,7 +2110,7 @@
|
|
|
2174
2110
|
}
|
|
2175
2111
|
}
|
|
2176
2112
|
function reduceAsyncWithoutInitialValue(iterable, fn) {
|
|
2177
|
-
if (types_1$2.isAsyncIterable(iterable)) {
|
|
2113
|
+
if ((0, types_1$2.isAsyncIterable)(iterable)) {
|
|
2178
2114
|
return reduceAsyncIterable(iterable);
|
|
2179
2115
|
}
|
|
2180
2116
|
else {
|
|
@@ -2237,9 +2173,9 @@
|
|
|
2237
2173
|
var reduce$1 = {};
|
|
2238
2174
|
|
|
2239
2175
|
reduce$1.reduce = void 0;
|
|
2240
|
-
const types_1$1 = es2018;
|
|
2176
|
+
const types_1$1 = es2018$2;
|
|
2241
2177
|
function reduce(iterable, fn, initialValue) {
|
|
2242
|
-
if (types_1$1.isUndefined(initialValue)) {
|
|
2178
|
+
if ((0, types_1$1.isUndefined)(initialValue)) {
|
|
2243
2179
|
return reduceWithoutInitialValue(iterable, fn);
|
|
2244
2180
|
}
|
|
2245
2181
|
else {
|
|
@@ -2284,9 +2220,9 @@
|
|
|
2284
2220
|
var someAsync$1 = {};
|
|
2285
2221
|
|
|
2286
2222
|
someAsync$1.someAsync = void 0;
|
|
2287
|
-
const types_1 = es2018;
|
|
2223
|
+
const types_1 = es2018$2;
|
|
2288
2224
|
function someAsync(iterable, predicate) {
|
|
2289
|
-
if (types_1.isAsyncIterable(iterable)) {
|
|
2225
|
+
if ((0, types_1.isAsyncIterable)(iterable)) {
|
|
2290
2226
|
return someAsyncIterable(iterable);
|
|
2291
2227
|
}
|
|
2292
2228
|
else {
|
|
@@ -2376,7 +2312,7 @@
|
|
|
2376
2312
|
toArrayAsync$1.toArrayAsync = void 0;
|
|
2377
2313
|
const consume_1$3 = consume$1;
|
|
2378
2314
|
function toArrayAsync(iterable) {
|
|
2379
|
-
return consume_1$3.consume(iterable, async (iterable) => {
|
|
2315
|
+
return (0, consume_1$3.consume)(iterable, async (iterable) => {
|
|
2380
2316
|
const result = [];
|
|
2381
2317
|
for await (const element of iterable) {
|
|
2382
2318
|
result.push(element);
|
|
@@ -2391,7 +2327,7 @@
|
|
|
2391
2327
|
toArray$1.toArray = void 0;
|
|
2392
2328
|
const consume_1$2 = consume$1;
|
|
2393
2329
|
function toArray(iterable) {
|
|
2394
|
-
return consume_1$2.consume(iterable, iterable => Array.from(iterable));
|
|
2330
|
+
return (0, consume_1$2.consume)(iterable, iterable => Array.from(iterable));
|
|
2395
2331
|
}
|
|
2396
2332
|
toArray$1.toArray = toArray;
|
|
2397
2333
|
|
|
@@ -2400,7 +2336,7 @@
|
|
|
2400
2336
|
toSetAsync$1.toSetAsync = void 0;
|
|
2401
2337
|
const consume_1$1 = consume$1;
|
|
2402
2338
|
function toSetAsync(iterable) {
|
|
2403
|
-
return consume_1$1.consume(iterable, async (iterable) => {
|
|
2339
|
+
return (0, consume_1$1.consume)(iterable, async (iterable) => {
|
|
2404
2340
|
const result = new Set();
|
|
2405
2341
|
for await (const element of iterable) {
|
|
2406
2342
|
result.add(element);
|
|
@@ -2415,7 +2351,7 @@
|
|
|
2415
2351
|
toSet$1.toSet = void 0;
|
|
2416
2352
|
const consume_1 = consume$1;
|
|
2417
2353
|
function toSet(iterable) {
|
|
2418
|
-
return consume_1.consume(iterable, iterable => new Set(iterable));
|
|
2354
|
+
return (0, consume_1.consume)(iterable, iterable => new Set(iterable));
|
|
2419
2355
|
}
|
|
2420
2356
|
toSet$1.toSet = toSet;
|
|
2421
2357
|
|
|
@@ -2468,7 +2404,471 @@
|
|
|
2468
2404
|
};__exportStar(middleware, exports);
|
|
2469
2405
|
__exportStar(output, exports);
|
|
2470
2406
|
|
|
2471
|
-
}(es2018$
|
|
2407
|
+
}(es2018$4));
|
|
2408
|
+
|
|
2409
|
+
var _LRUMap_limit, _LRUMap_map;
|
|
2410
|
+
class LRUMap {
|
|
2411
|
+
constructor(limit) {
|
|
2412
|
+
_LRUMap_limit.set(this, void 0);
|
|
2413
|
+
_LRUMap_map.set(this, new Map());
|
|
2414
|
+
es2018$5.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
|
|
2415
|
+
es2018$5.assert(limit > 0, 'The parameter limit must be a positive value');
|
|
2416
|
+
__classPrivateFieldSet(this, _LRUMap_limit, limit, "f");
|
|
2417
|
+
}
|
|
2418
|
+
get [(_LRUMap_limit = new WeakMap(), _LRUMap_map = new WeakMap(), Symbol.toStringTag)]() {
|
|
2419
|
+
return this.constructor.name;
|
|
2420
|
+
}
|
|
2421
|
+
get size() {
|
|
2422
|
+
return __classPrivateFieldGet(this, _LRUMap_map, "f").size;
|
|
2423
|
+
}
|
|
2424
|
+
set(key, value) {
|
|
2425
|
+
if (__classPrivateFieldGet(this, _LRUMap_map, "f").has(key)) {
|
|
2426
|
+
this.updateItem(key, value);
|
|
2427
|
+
}
|
|
2428
|
+
else {
|
|
2429
|
+
if (__classPrivateFieldGet(this, _LRUMap_map, "f").size === __classPrivateFieldGet(this, _LRUMap_limit, "f")) {
|
|
2430
|
+
__classPrivateFieldGet(this, _LRUMap_map, "f").delete(this.getColdestKey());
|
|
2431
|
+
}
|
|
2432
|
+
__classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
|
|
2433
|
+
}
|
|
2434
|
+
return this;
|
|
2435
|
+
}
|
|
2436
|
+
has(key) {
|
|
2437
|
+
return __classPrivateFieldGet(this, _LRUMap_map, "f").has(key);
|
|
2438
|
+
}
|
|
2439
|
+
get(key) {
|
|
2440
|
+
if (!this.has(key))
|
|
2441
|
+
return undefined;
|
|
2442
|
+
const value = __classPrivateFieldGet(this, _LRUMap_map, "f").get(key);
|
|
2443
|
+
this.updateItem(key, value);
|
|
2444
|
+
return value;
|
|
2445
|
+
}
|
|
2446
|
+
delete(key) {
|
|
2447
|
+
return __classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
|
|
2448
|
+
}
|
|
2449
|
+
clear() {
|
|
2450
|
+
__classPrivateFieldGet(this, _LRUMap_map, "f").clear();
|
|
2451
|
+
}
|
|
2452
|
+
/**
|
|
2453
|
+
* Reinsert the item.
|
|
2454
|
+
*/
|
|
2455
|
+
updateItem(key, value) {
|
|
2456
|
+
__classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
|
|
2457
|
+
__classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Return the earliest key inserted in the Map
|
|
2461
|
+
*/
|
|
2462
|
+
getColdestKey() {
|
|
2463
|
+
return es2018$4.first(__classPrivateFieldGet(this, _LRUMap_map, "f").keys());
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
var es2018$1 = {};
|
|
2468
|
+
|
|
2469
|
+
var exponentialBackoff = {};
|
|
2470
|
+
|
|
2471
|
+
var es2018 = {};
|
|
2472
|
+
|
|
2473
|
+
var random$1 = {};
|
|
2474
|
+
|
|
2475
|
+
random$1.random = void 0;
|
|
2476
|
+
function random(min, max) {
|
|
2477
|
+
return Math.random() * (max - min) + min;
|
|
2478
|
+
}
|
|
2479
|
+
random$1.random = random;
|
|
2480
|
+
|
|
2481
|
+
var randomInt$1 = {};
|
|
2482
|
+
|
|
2483
|
+
randomInt$1.randomInt = void 0;
|
|
2484
|
+
function randomInt(min, max) {
|
|
2485
|
+
min = Math.ceil(min);
|
|
2486
|
+
max = Math.floor(max);
|
|
2487
|
+
return Math.floor(Math.random() * (max - min)) + min;
|
|
2488
|
+
}
|
|
2489
|
+
randomInt$1.randomInt = randomInt;
|
|
2490
|
+
|
|
2491
|
+
var randomIntInclusive$1 = {};
|
|
2492
|
+
|
|
2493
|
+
randomIntInclusive$1.randomIntInclusive = void 0;
|
|
2494
|
+
function randomIntInclusive(min, max) {
|
|
2495
|
+
min = Math.ceil(min);
|
|
2496
|
+
max = Math.floor(max);
|
|
2497
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
2498
|
+
}
|
|
2499
|
+
randomIntInclusive$1.randomIntInclusive = randomIntInclusive;
|
|
2500
|
+
|
|
2501
|
+
(function (exports) {
|
|
2502
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2503
|
+
if (k2 === undefined) k2 = k;
|
|
2504
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
2505
|
+
}) : (function(o, m, k, k2) {
|
|
2506
|
+
if (k2 === undefined) k2 = k;
|
|
2507
|
+
o[k2] = m[k];
|
|
2508
|
+
}));
|
|
2509
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
2510
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2511
|
+
};__exportStar(random$1, exports);
|
|
2512
|
+
__exportStar(randomInt$1, exports);
|
|
2513
|
+
__exportStar(randomIntInclusive$1, exports);
|
|
2514
|
+
|
|
2515
|
+
}(es2018));
|
|
2516
|
+
|
|
2517
|
+
exponentialBackoff.calculateExponentialBackoffTimeout = void 0;
|
|
2518
|
+
const extra_rand_1 = es2018;
|
|
2519
|
+
function calculateExponentialBackoffTimeout({ baseTimeout, retries, maxTimeout = Infinity, factor = 2, jitter = true }) {
|
|
2520
|
+
const timeout = Math.min(factor ** retries * baseTimeout, maxTimeout);
|
|
2521
|
+
if (jitter) {
|
|
2522
|
+
return (0, extra_rand_1.randomIntInclusive)(0, timeout);
|
|
2523
|
+
}
|
|
2524
|
+
else {
|
|
2525
|
+
return timeout;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
exponentialBackoff.calculateExponentialBackoffTimeout = calculateExponentialBackoffTimeout;
|
|
2529
|
+
|
|
2530
|
+
var setTimeout$1 = {};
|
|
2531
|
+
|
|
2532
|
+
setTimeout$1.setTimeout = void 0;
|
|
2533
|
+
function setTimeout(timeout, cb) {
|
|
2534
|
+
const timer = globalThis.setTimeout(cb, timeout);
|
|
2535
|
+
return () => clearTimeout(timer);
|
|
2536
|
+
}
|
|
2537
|
+
setTimeout$1.setTimeout = setTimeout;
|
|
2538
|
+
|
|
2539
|
+
var setSchedule$1 = {};
|
|
2540
|
+
|
|
2541
|
+
setSchedule$1.setSchedule = void 0;
|
|
2542
|
+
const set_timeout_1$3 = setTimeout$1;
|
|
2543
|
+
function setSchedule(timestamp, cb) {
|
|
2544
|
+
const timeout = timestamp - Date.now();
|
|
2545
|
+
return (0, set_timeout_1$3.setTimeout)(timeout, cb);
|
|
2546
|
+
}
|
|
2547
|
+
setSchedule$1.setSchedule = setSchedule;
|
|
2548
|
+
|
|
2549
|
+
var setInterval$1 = {};
|
|
2550
|
+
|
|
2551
|
+
setInterval$1.setInterval = void 0;
|
|
2552
|
+
function setInterval(timeout, cb) {
|
|
2553
|
+
const timer = globalThis.setInterval(cb, timeout);
|
|
2554
|
+
return () => clearInterval(timer);
|
|
2555
|
+
}
|
|
2556
|
+
setInterval$1.setInterval = setInterval;
|
|
2557
|
+
|
|
2558
|
+
var setImmediate$1 = {};
|
|
2559
|
+
|
|
2560
|
+
setImmediate$1.setImmediate = void 0;
|
|
2561
|
+
const set_timeout_1$2 = setTimeout$1;
|
|
2562
|
+
function setImmediate(cb) {
|
|
2563
|
+
if (globalThis.setImmediate) {
|
|
2564
|
+
const timer = globalThis.setImmediate(cb);
|
|
2565
|
+
return () => clearImmediate(timer);
|
|
2566
|
+
}
|
|
2567
|
+
else {
|
|
2568
|
+
return (0, set_timeout_1$2.setTimeout)(0, cb);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
setImmediate$1.setImmediate = setImmediate;
|
|
2572
|
+
|
|
2573
|
+
var setTimeoutLoop$1 = {};
|
|
2574
|
+
|
|
2575
|
+
setTimeoutLoop$1.setTimeoutLoop = void 0;
|
|
2576
|
+
const set_timeout_1$1 = setTimeout$1;
|
|
2577
|
+
function setTimeoutLoop(timeout, cb) {
|
|
2578
|
+
let isCancelled = false;
|
|
2579
|
+
let cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
|
|
2580
|
+
return () => {
|
|
2581
|
+
isCancelled = true;
|
|
2582
|
+
cancel();
|
|
2583
|
+
};
|
|
2584
|
+
async function loop() {
|
|
2585
|
+
await cb();
|
|
2586
|
+
if (!isCancelled) {
|
|
2587
|
+
cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
setTimeoutLoop$1.setTimeoutLoop = setTimeoutLoop;
|
|
2592
|
+
|
|
2593
|
+
var setDynamicTimeoutLoop$1 = {};
|
|
2594
|
+
|
|
2595
|
+
setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = void 0;
|
|
2596
|
+
const set_timeout_1 = setTimeout$1;
|
|
2597
|
+
function setDynamicTimeoutLoop(timeout, cb) {
|
|
2598
|
+
let isCancelled = false;
|
|
2599
|
+
let cancel = (0, set_timeout_1.setTimeout)(timeout, loop);
|
|
2600
|
+
return () => {
|
|
2601
|
+
isCancelled = true;
|
|
2602
|
+
cancel();
|
|
2603
|
+
};
|
|
2604
|
+
async function loop() {
|
|
2605
|
+
const start = Date.now();
|
|
2606
|
+
await cb();
|
|
2607
|
+
const elapsed = Date.now() - start;
|
|
2608
|
+
if (!isCancelled) {
|
|
2609
|
+
cancel = (0, set_timeout_1.setTimeout)(Math.max(timeout - elapsed, 0), loop);
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = setDynamicTimeoutLoop;
|
|
2614
|
+
|
|
2615
|
+
(function (exports) {
|
|
2616
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2617
|
+
if (k2 === undefined) k2 = k;
|
|
2618
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
2619
|
+
}) : (function(o, m, k, k2) {
|
|
2620
|
+
if (k2 === undefined) k2 = k;
|
|
2621
|
+
o[k2] = m[k];
|
|
2622
|
+
}));
|
|
2623
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
2624
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2625
|
+
};__exportStar(exponentialBackoff, exports);
|
|
2626
|
+
__exportStar(setTimeout$1, exports);
|
|
2627
|
+
__exportStar(setSchedule$1, exports);
|
|
2628
|
+
__exportStar(setInterval$1, exports);
|
|
2629
|
+
__exportStar(setImmediate$1, exports);
|
|
2630
|
+
__exportStar(setTimeoutLoop$1, exports);
|
|
2631
|
+
__exportStar(setDynamicTimeoutLoop$1, exports);
|
|
2632
|
+
|
|
2633
|
+
}(es2018$1));
|
|
2634
|
+
|
|
2635
|
+
var _ExpirableMap_map, _ExpirableMap_cancelClearTimeout;
|
|
2636
|
+
class ExpirableMap {
|
|
2637
|
+
constructor() {
|
|
2638
|
+
_ExpirableMap_map.set(this, new Map());
|
|
2639
|
+
_ExpirableMap_cancelClearTimeout.set(this, void 0);
|
|
2640
|
+
/**
|
|
2641
|
+
* 按过期时间升序排列所有项目的元数据
|
|
2642
|
+
*/
|
|
2643
|
+
this.itemMetadataSortedByExpirationTime = [];
|
|
2644
|
+
}
|
|
2645
|
+
get [(_ExpirableMap_map = new WeakMap(), _ExpirableMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
|
|
2646
|
+
return this.constructor.name;
|
|
2647
|
+
}
|
|
2648
|
+
get size() {
|
|
2649
|
+
return __classPrivateFieldGet(this, _ExpirableMap_map, "f").size;
|
|
2650
|
+
}
|
|
2651
|
+
set(key, value, maxAge) {
|
|
2652
|
+
__classPrivateFieldGet(this, _ExpirableMap_map, "f").set(key, value);
|
|
2653
|
+
this.removeItemMetadata(key);
|
|
2654
|
+
this.addItemMetadata(key, Date.now() + maxAge);
|
|
2655
|
+
return this;
|
|
2656
|
+
}
|
|
2657
|
+
has(key) {
|
|
2658
|
+
return __classPrivateFieldGet(this, _ExpirableMap_map, "f").has(key);
|
|
2659
|
+
}
|
|
2660
|
+
get(key) {
|
|
2661
|
+
return __classPrivateFieldGet(this, _ExpirableMap_map, "f").get(key);
|
|
2662
|
+
}
|
|
2663
|
+
delete(key) {
|
|
2664
|
+
const exists = __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(key);
|
|
2665
|
+
if (exists) {
|
|
2666
|
+
const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
|
|
2667
|
+
this.itemMetadataSortedByExpirationTime.splice(index, 1);
|
|
2668
|
+
// 如果被删除的项目是第一个项目, 则需要重新规划过期回调
|
|
2669
|
+
if (index === 0) {
|
|
2670
|
+
this.rescheduleClearTimeout();
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
return exists;
|
|
2674
|
+
}
|
|
2675
|
+
clear() {
|
|
2676
|
+
var _a;
|
|
2677
|
+
__classPrivateFieldGet(this, _ExpirableMap_map, "f").clear();
|
|
2678
|
+
(_a = __classPrivateFieldGet(this, _ExpirableMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2679
|
+
this.itemMetadataSortedByExpirationTime = [];
|
|
2680
|
+
}
|
|
2681
|
+
addItemMetadata(key, expirationTime) {
|
|
2682
|
+
for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
|
|
2683
|
+
const item = this.itemMetadataSortedByExpirationTime[i];
|
|
2684
|
+
if (expirationTime < item.expirationTime) {
|
|
2685
|
+
this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
|
|
2686
|
+
// 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
|
|
2687
|
+
if (i === 0) {
|
|
2688
|
+
this.rescheduleClearTimeout();
|
|
2689
|
+
}
|
|
2690
|
+
return;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
// 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
|
|
2694
|
+
this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
|
|
2695
|
+
// 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
|
|
2696
|
+
if (this.itemMetadataSortedByExpirationTime.length === 1) {
|
|
2697
|
+
this.rescheduleClearTimeout();
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
removeItemMetadata(key) {
|
|
2701
|
+
const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
|
|
2702
|
+
if (index >= 0) {
|
|
2703
|
+
this.itemMetadataSortedByExpirationTime.splice(index, 1);
|
|
2704
|
+
// 如果被移除的是第一个项目, 则需要重新规划过期回调
|
|
2705
|
+
if (index === 0) {
|
|
2706
|
+
this.rescheduleClearTimeout();
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
clearExpiredItems(timestamp) {
|
|
2711
|
+
const indexOfFirstUnexpired = this.itemMetadataSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
|
|
2712
|
+
const expiredItemKeys = indexOfFirstUnexpired >= 0
|
|
2713
|
+
? this.itemMetadataSortedByExpirationTime.splice(0, indexOfFirstUnexpired)
|
|
2714
|
+
: this.itemMetadataSortedByExpirationTime.splice(0, this.itemMetadataSortedByExpirationTime.length);
|
|
2715
|
+
expiredItemKeys.forEach(x => __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(x.key));
|
|
2716
|
+
}
|
|
2717
|
+
rescheduleClearTimeout() {
|
|
2718
|
+
var _a;
|
|
2719
|
+
(_a = __classPrivateFieldGet(this, _ExpirableMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2720
|
+
if (this.itemMetadataSortedByExpirationTime.length > 0) {
|
|
2721
|
+
const item = this.itemMetadataSortedByExpirationTime[0];
|
|
2722
|
+
if (Number.isFinite(item.expirationTime)) {
|
|
2723
|
+
const cancel = es2018$1.setSchedule(item.expirationTime, () => {
|
|
2724
|
+
this.clearExpiredItems(Date.now());
|
|
2725
|
+
this.rescheduleClearTimeout();
|
|
2726
|
+
});
|
|
2727
|
+
__classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, () => {
|
|
2728
|
+
cancel();
|
|
2729
|
+
__classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, undefined, "f");
|
|
2730
|
+
}, "f");
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
var _TLRUMap_limit, _TLRUMap_map, _TLRUMap_cancelClearTimeout;
|
|
2737
|
+
/**
|
|
2738
|
+
* TLRUMap = LRUMap + ExpirableMap
|
|
2739
|
+
*/
|
|
2740
|
+
class TLRUMap {
|
|
2741
|
+
constructor(limit) {
|
|
2742
|
+
_TLRUMap_limit.set(this, void 0);
|
|
2743
|
+
_TLRUMap_map.set(this, new Map());
|
|
2744
|
+
_TLRUMap_cancelClearTimeout.set(this, void 0);
|
|
2745
|
+
/**
|
|
2746
|
+
* 按过期时间升序排列所有项目的元数据
|
|
2747
|
+
*/
|
|
2748
|
+
this.itemMetadataSortedByExpirationTime = [];
|
|
2749
|
+
es2018$5.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
|
|
2750
|
+
es2018$5.assert(limit > 0, 'The parameter limit must be a positive value');
|
|
2751
|
+
__classPrivateFieldSet(this, _TLRUMap_limit, limit, "f");
|
|
2752
|
+
}
|
|
2753
|
+
get [(_TLRUMap_limit = new WeakMap(), _TLRUMap_map = new WeakMap(), _TLRUMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
|
|
2754
|
+
return this.constructor.name;
|
|
2755
|
+
}
|
|
2756
|
+
get size() {
|
|
2757
|
+
return __classPrivateFieldGet(this, _TLRUMap_map, "f").size;
|
|
2758
|
+
}
|
|
2759
|
+
set(key, value, maxAge) {
|
|
2760
|
+
if (__classPrivateFieldGet(this, _TLRUMap_map, "f").has(key)) {
|
|
2761
|
+
this.updateItem(key, value);
|
|
2762
|
+
this.removeItemMetadata(key);
|
|
2763
|
+
this.addItemMetadata(key, Date.now() + maxAge);
|
|
2764
|
+
}
|
|
2765
|
+
else {
|
|
2766
|
+
if (__classPrivateFieldGet(this, _TLRUMap_map, "f").size === __classPrivateFieldGet(this, _TLRUMap_limit, "f")) {
|
|
2767
|
+
__classPrivateFieldGet(this, _TLRUMap_map, "f").delete(this.getColdestKey());
|
|
2768
|
+
}
|
|
2769
|
+
__classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
|
|
2770
|
+
this.addItemMetadata(key, Date.now() + maxAge);
|
|
2771
|
+
}
|
|
2772
|
+
return this;
|
|
2773
|
+
}
|
|
2774
|
+
has(key) {
|
|
2775
|
+
return __classPrivateFieldGet(this, _TLRUMap_map, "f").has(key);
|
|
2776
|
+
}
|
|
2777
|
+
get(key) {
|
|
2778
|
+
if (this.has(key)) {
|
|
2779
|
+
const value = __classPrivateFieldGet(this, _TLRUMap_map, "f").get(key);
|
|
2780
|
+
this.updateItem(key, value);
|
|
2781
|
+
return value;
|
|
2782
|
+
}
|
|
2783
|
+
else {
|
|
2784
|
+
return undefined;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
delete(key) {
|
|
2788
|
+
const result = __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
|
|
2789
|
+
if (result) {
|
|
2790
|
+
const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
|
|
2791
|
+
this.itemMetadataSortedByExpirationTime.splice(index, 1);
|
|
2792
|
+
// 如果被删除的项目是第一个项目, 则需要重新规划过期回调
|
|
2793
|
+
if (index === 0) {
|
|
2794
|
+
this.rescheduleClearTimeout();
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
return result;
|
|
2798
|
+
}
|
|
2799
|
+
clear() {
|
|
2800
|
+
var _a;
|
|
2801
|
+
__classPrivateFieldGet(this, _TLRUMap_map, "f").clear();
|
|
2802
|
+
(_a = __classPrivateFieldGet(this, _TLRUMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2803
|
+
this.itemMetadataSortedByExpirationTime = [];
|
|
2804
|
+
}
|
|
2805
|
+
/**
|
|
2806
|
+
* 重新插入项目, 这会使项目置于#map迭代器的末端.
|
|
2807
|
+
*/
|
|
2808
|
+
updateItem(key, value) {
|
|
2809
|
+
__classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
|
|
2810
|
+
__classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
|
|
2811
|
+
}
|
|
2812
|
+
addItemMetadata(key, expirationTime) {
|
|
2813
|
+
for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
|
|
2814
|
+
const item = this.itemMetadataSortedByExpirationTime[i];
|
|
2815
|
+
if (expirationTime < item.expirationTime) {
|
|
2816
|
+
this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
|
|
2817
|
+
// 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
|
|
2818
|
+
if (i === 0) {
|
|
2819
|
+
this.rescheduleClearTimeout();
|
|
2820
|
+
}
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
// 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
|
|
2825
|
+
this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
|
|
2826
|
+
// 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
|
|
2827
|
+
if (this.itemMetadataSortedByExpirationTime.length === 1) {
|
|
2828
|
+
this.rescheduleClearTimeout();
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
removeItemMetadata(key) {
|
|
2832
|
+
const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
|
|
2833
|
+
if (index >= 0) {
|
|
2834
|
+
this.itemMetadataSortedByExpirationTime.splice(index, 1);
|
|
2835
|
+
// 如果被移除的是第一个项目, 则需要重新规划过期回调
|
|
2836
|
+
if (index === 0) {
|
|
2837
|
+
this.rescheduleClearTimeout();
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
clearExpiredItems(timestamp) {
|
|
2842
|
+
const indexOfFirstUnexpiredItem = this.itemMetadataSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
|
|
2843
|
+
const expiredItemKeys = indexOfFirstUnexpiredItem >= 0
|
|
2844
|
+
? this.itemMetadataSortedByExpirationTime.splice(0, indexOfFirstUnexpiredItem)
|
|
2845
|
+
: this.itemMetadataSortedByExpirationTime.splice(0, this.itemMetadataSortedByExpirationTime.length);
|
|
2846
|
+
expiredItemKeys.forEach(x => __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(x.key));
|
|
2847
|
+
}
|
|
2848
|
+
rescheduleClearTimeout() {
|
|
2849
|
+
var _a;
|
|
2850
|
+
(_a = __classPrivateFieldGet(this, _TLRUMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2851
|
+
if (this.itemMetadataSortedByExpirationTime.length > 0) {
|
|
2852
|
+
const item = this.itemMetadataSortedByExpirationTime[0];
|
|
2853
|
+
if (Number.isFinite(item.expirationTime)) {
|
|
2854
|
+
const cancel = es2018$1.setSchedule(item.expirationTime, () => {
|
|
2855
|
+
this.clearExpiredItems(Date.now());
|
|
2856
|
+
this.rescheduleClearTimeout();
|
|
2857
|
+
});
|
|
2858
|
+
__classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, () => {
|
|
2859
|
+
cancel();
|
|
2860
|
+
__classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, undefined, "f");
|
|
2861
|
+
}, "f");
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* Return the earliest key inserted in the Map
|
|
2867
|
+
*/
|
|
2868
|
+
getColdestKey() {
|
|
2869
|
+
return es2018$4.first(__classPrivateFieldGet(this, _TLRUMap_map, "f").keys());
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2472
2872
|
|
|
2473
2873
|
var _TrieMap_root;
|
|
2474
2874
|
class TrieNode {
|
|
@@ -2534,7 +2934,7 @@
|
|
|
2534
2934
|
delete node.value;
|
|
2535
2935
|
// 如果节点没有后缀, 则代表这是末端节点, 往前删除其前缀
|
|
2536
2936
|
if (node.children.size === 0) {
|
|
2537
|
-
for (const [part, parentNode] of es2018$
|
|
2937
|
+
for (const [part, parentNode] of es2018$4.toArray(es2018$4.zip(key, parentNodes)).reverse()) {
|
|
2538
2938
|
parentNode.children.delete(part);
|
|
2539
2939
|
if (parentNode.children.size !== 0)
|
|
2540
2940
|
break;
|
|
@@ -2544,16 +2944,19 @@
|
|
|
2544
2944
|
}
|
|
2545
2945
|
}
|
|
2546
2946
|
|
|
2947
|
+
exports.Box = Box;
|
|
2547
2948
|
exports.Emitter = Emitter;
|
|
2949
|
+
exports.ExpirableMap = ExpirableMap;
|
|
2548
2950
|
exports.HashMap = HashMap;
|
|
2549
2951
|
exports.HashSet = HashSet;
|
|
2550
2952
|
exports.LRUMap = LRUMap;
|
|
2551
2953
|
exports.Queue = Queue;
|
|
2954
|
+
exports.TLRUMap = TLRUMap;
|
|
2552
2955
|
exports.TrieMap = TrieMap;
|
|
2553
2956
|
exports.convertArrayToCons = convertArrayToCons;
|
|
2554
2957
|
exports.convertConsToArray = convertConsToArray;
|
|
2555
2958
|
|
|
2556
2959
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2557
2960
|
|
|
2558
|
-
}))
|
|
2961
|
+
}));
|
|
2559
2962
|
//# sourceMappingURL=index.umd.js.map
|